diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-03 23:19:14 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-03 23:19:14 +0000 |
commit | 5fcfd1f07e71f24d4a43cac970ec39b514154d69 (patch) | |
tree | cc03ca70db88b8dbb1ec5e96164c46948bbeeb54 /Completion/Debian/_deb_packages | |
parent | cef45cd543c1c8ac2da327803ac878a87435329f (diff) | |
download | zsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.tar.gz zsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.tar.xz zsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.zip |
zsh-workers/7641
Diffstat (limited to 'Completion/Debian/_deb_packages')
-rw-r--r-- | Completion/Debian/_deb_packages | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Completion/Debian/_deb_packages b/Completion/Debian/_deb_packages index b5e4ffd85..cb74137bf 100644 --- a/Completion/Debian/_deb_packages +++ b/Completion/Debian/_deb_packages @@ -1,7 +1,27 @@ #autoload -if (( ! $+_deb_packages )); then - _deb_packages=( $(awk '/^Package:/ { print $2 }' /var/lib/dpkg/status) ) +# Usage: _deb_packages installed|uninstalled|avail + +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 -compadd "$@" - $_deb_packages +local command="$1" +shift + +case "$command" in + installed) compadd "$@" - $_deb_cache_installed;; + uninstalled) compadd "$@" - $_deb_cache_uninstalled;; + avail) compadd "$@" - $_deb_cache_avail;; +esac |