From 2af81120c37ea63cccf1e89413738bd8da08a49f Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 2 Oct 2021 17:28:44 +0200 Subject: [PATCH] Manager: Implement convenience functions in Package --- src/package.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/package.cpp b/src/package.cpp index fe0217c..e1294b4 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -41,19 +41,20 @@ void Package::list(const std::vector& targets) Util::System $; if (m_distro == Distro::Arch) { - auto basePackages = $("pactree -u base") | $("tail -n +2"); + auto basePackages = $("pactree -u base").tail(2, true); auto develPackages = $("pacman -Qqg base-devel"); - auto filterList = basePackages + develPackages | $("sort -u"); - auto packageList = $("pacman -Qqe") | $("grep -vx " + filterList.output()) | $("sort"); + auto filterList = (basePackages + develPackages).sort(true); + auto packageList = ($("pacman -Qqe") | $("grep -xv " + filterList.output())).sort(); packages = packageList.output(); } else if (m_distro == Distro::Debian) { auto installedList = $("dpkg-query --show --showformat=${Package}\\t${Priority}\\n"); - auto filterList = installedList | $("grep -E required|important|standard") | $("cut -f 1"); - installedList = installedList | $("cut -f 1"); + auto filterList = (installedList | $("grep -E required|important|standard")).cut(1); + installedList = installedList.cut(1); auto installedManuallyList = $("awk '/Commandline:.* install / && !/APT::/ { print $NF }' /var/log/apt/history.log"); - installedManuallyList = (installedManuallyList + $("apt-mark showmanual")) | $("sort -u"); - auto packageList = installedManuallyList | $("grep -x " + installedList.output()) | $("grep -vx " + filterList.output()); + installedManuallyList = (installedManuallyList + $("apt-mark showmanual")).sort(true); + auto packageList = installedManuallyList | $("grep -x " + installedList.output()) | $("grep -xv " + filterList.output()); + packages = packageList.output(); } if (targets.empty()) {