Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: stylistic override to _deb_packages



With this patch, 'packageset' can be used to override the
argument to _deb_packages.

Index: Completion/Debian/_deb_packages
===================================================================
RCS file: /cvs/zsh/zsh/Completion/Debian/_deb_packages,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 _deb_packages
--- Completion/Debian/_deb_packages	1999/12/27 21:22:24	1.1.1.5
+++ Completion/Debian/_deb_packages	2000/01/29 22:31:49
@@ -32,16 +32,24 @@
 }
 
 _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}"}"
 }
Index: Completion/Debian/_dpkg
===================================================================
RCS file: /cvs/zsh/zsh/Completion/Debian/_dpkg,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _dpkg
--- Completion/Debian/_dpkg	1999/12/29 07:44:21	1.1.1.4
+++ Completion/Debian/_dpkg	2000/01/29 22:31:49
@@ -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 @@
            '--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 @@
            '--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' \
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvs/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.1.1.116
diff -u -r1.1.1.116 compsys.yo
--- Doc/Zsh/compsys.yo	2000/01/21 16:33:54	1.1.1.116
+++ Doc/Zsh/compsys.yo	2000/01/29 22:31:50
@@ -546,7 +546,7 @@
 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
@@ -1108,6 +1108,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



Messages sorted by: Reverse Date, Date, Thread, Author