about summary refs log tree commit diff
path: root/xpkg
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-12-17 17:35:00 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2015-12-17 17:35:00 +0100
commit16529ff2fba610212b3e2dce225fb7248dcdca90 (patch)
treeb34d7f5b485a9ceef8806ed61f4ac48995a62f57 /xpkg
parentde21325de3c510d62e454b6ffe2620dfa52faa1f (diff)
downloadxtools-16529ff2fba610212b3e2dce225fb7248dcdca90.tar.gz
xtools-16529ff2fba610212b3e2dce225fb7248dcdca90.tar.xz
xtools-16529ff2fba610212b3e2dce225fb7248dcdca90.zip
add xpkg v0.32
Diffstat (limited to 'xpkg')
-rwxr-xr-xxpkg30
1 files changed, 30 insertions, 0 deletions
diff --git a/xpkg b/xpkg
new file mode 100755
index 0000000..40e6ed1
--- /dev/null
+++ b/xpkg
@@ -0,0 +1,30 @@
+#!/bin/sh
+# xpkg [-RamOHvV] - convenient package lister
+
+flags=
+filter0='/^.[^i*].\? /d'
+filter1='s/^...\? //'
+filter2='s/-[^- ]* .*//'
+mode="--search="
+
+while getopts R:vVmOHa flag; do
+	case "$flag" in
+		R) flags="$flags -i --repository=$OPTARG";;
+		m|O|H) mode="-$flag"; filter0=; filter1=; filter2='s/-[^-]*$//';;
+		a) flags="$flags -R"; filter0=;;
+		v) filter2='s/ .*//';;
+		V) filter2=;;
+		?) printf "Usage: %s [-RamOHvV]
+  -R REPO  consider only packages from REPO
+  -a       list all packages (default: only installed)
+  -m	   list manual packages
+  -O       list orphaned packages
+  -H       list packages on hold
+  -v       show version numbers
+  -V       show version numbers and description
+" $0 1>&2
+		exit 1;;
+	esac
+done
+
+xbps-query $flags $mode | sed "$filter0;$filter1;$filter2"