about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Debian/_deb_packages12
-rw-r--r--Completion/Debian/_dpkg9
-rw-r--r--Doc/Zsh/compsys.yo11
3 files changed, 22 insertions, 10 deletions
diff --git a/Completion/Debian/_deb_packages b/Completion/Debian/_deb_packages
index efd33f93b..29b37ea48 100644
--- a/Completion/Debian/_deb_packages
+++ b/Completion/Debian/_deb_packages
@@ -32,16 +32,24 @@ _deb_packages_updage_uninstalled () {
 }
 
 _deb_packages () {
-  local command="$argv[$#]" expl cachevar
+  local command="$argv[$#]" expl cachevar pkgset
 
   [[ "$command" = (installed|uninstalled|avail) ]] || {
     _message "_deb_packages:unknown command: $command"
     return
   }
 
+  zstyle -s ":completion${curcontext}" packageset pkgset
+
+  [[ "$pkgset" = (installed|uninstalled|avail|available) ]] || {
+    pkgset="$command"
+  }
+
+  [[ "$pkgset" = "available" ]] && pkgset="avail"
+
   expl=("${(@)argv[1,-2]}")
 
-  _deb_packages_updage_$command
+  _deb_packages_updage_$pkgset
 
   _tags packages && compadd "$expl[@]" - "${(e):-"\${(@)$cachevar}"}"
 }
diff --git a/Completion/Debian/_dpkg b/Completion/Debian/_dpkg
index fd64b3297..ca7d11a58 100644
--- a/Completion/Debian/_dpkg
+++ b/Completion/Debian/_dpkg
@@ -1,7 +1,5 @@
 #compdef dpkg dpkg-deb
 
-local dds
-
 _dpkg_deb_args=('(--build)-b[build archive]:directory:_files -/' \
            '(-b)--build:directory:_files -/' \
            '(--contents)-c[list contents]:Debian package:_files -g \*.deb' \
@@ -22,9 +20,6 @@ _dpkg_common_args=('--help[show help]' \
            '--version[show version]' \
            '--licence[show licensing]')
 
-zstyle -s ':completion${curcontext}:deb:dpkg' status dds
-[[ "$dds" == installed ]] || dds="avail"
-
 case "$words[1]" in
 dpkg)
 _arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb' \
@@ -43,8 +38,8 @@ _arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb'
            '--merge-avail[merge available]:package file:_files' \
            '--clear-avail[clear available]' \
            '--forget-old-unavail[forget uninstalled unavailable]' \
-           '(--status)-s[display package status]:packages:_deb_packages $dds' \
-           '(-s)--status:packages:_deb_packages $dds' \
+           '(--status)-s[display package status]:packages:_deb_packages installed' \
+           '(-s)--status:packages:_deb_packages installed' \
            '(--print-avail)-p[display available details]:packages:_deb_packages avail' \
            '(-p)--print-avail:packages:_deb_packages avail' \
            '(--listfiles)-L[list owned files]:packages:_deb_packages installed' \
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 0126a4544..4e73f08c5 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -546,7 +546,7 @@ item(tt(other-accounts))(
 used to look up the tt(users-hosts) style
 )
 item(tt(packages))(
-for packages (e.g. tt(rpm) packages)
+for packages (e.g. tt(rpm) or installed tt(Debian) packages)
 )
 item(tt(parameters))(
 for names of parameters
@@ -1109,6 +1109,15 @@ it will first try to generate matches without inserting the `tt(*)'
 and if that yields no matches, it will try again with the `tt(*)'
 inserted.
 )
+item(tt(packageset))(
+A style containing an override for the default package set
+for that context.  For example,
+
+example(zstyle :completion:complete::dpkg::--status-1 packageset avail)
+
+will cause available packages, rather than only installed packages,
+to be completed for `dpkg --status'.
+)
 item(tt(path))(
 This is used together with the the tt(urls) tag by completion
 functions that generate URLs as possible matches. It should be set to