summary refs log tree commit diff
path: root/xpkg
blob: d534d418ffdbe41fdb7ae2a6573d3d83ff5fe645 (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
31
32
#!/bin/bash
# xpkg [-RamOHDvV] - convenient package lister

flags=
filter0='/^.[^i*].\? /d'
filter1='s/^...\? //'
filter2='s/-[^- ]* .*//'
mode="--search="

while getopts R:vVmOHDa flag; do
	case "$flag" in
		D) exec comm -23 <(xpkg | sort) <(xpkg -a | sort);;
		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
  -D       list installed packages not in repo
  -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"