blob: 9561641b7d5edccaac1a21de5e7763fbd4a04293 (
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
33
34
35
36
37
|
#autoload
local opt caopts
# Usage: _deb_packages installed|uninstalled|avail
while getopts "J:" opt; do
case "$opt" in
J) caopts="-J $OPTARG"
shift 2 # presume that -J -default- are the first args
;;
esac
done
if (( ! $+_deb_cache_dpkg_get_selections )); then
_deb_cache_dpkg_get_selections=(
${(f)"$(dpkg --get-selections)"}
)
_deb_cache_avail=(
${(f)"$(apt-cache dumpavail | awk '/^Package:/ { print $2 }')"}
)
_deb_cache_installed=(
${${_deb_cache_dpkg_get_selections:#*deinstall}%% *}
)
_deb_cache_uninstalled=(
${_deb_cache_avail:#${(j:|:)~${_deb_cache_installed:q}}}
)
fi
local command="$1" expl
shift
_wanted packages expl packages &&
case "$command" in
installed) compadd "$@" - $_deb_cache_installed;;
uninstalled) compadd "$@" - $_deb_cache_uninstalled;;
avail) compadd "$@" - $_deb_cache_avail;;
esac
|