summary refs log tree commit diff
path: root/xpkg
blob: 40e6ed1c139d3715491e45f8d99baa50e44296d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"