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

PATCH: dpkg -s style support for _dpkg



This allows user-level configuration of how dpkg -s calls _deb_packages.

Index: Completion/Debian/_dpkg
===================================================================
RCS file: /cvs/zsh/zsh/Completion/Debian/_dpkg,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _dpkg
--- Completion/Debian/_dpkg	1999/12/22 17:19:44	1.1.1.3
+++ Completion/Debian/_dpkg	1999/12/29 02:53:15
@@ -1,5 +1,7 @@
 #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' \
@@ -20,6 +22,9 @@
            '--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' \
@@ -38,8 +43,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 avail' \
-           '(-s)--status:packages:_deb_packages avail' \
+           '(--status)-s[display package status]:packages:_deb_packages $dds' \
+           '(-s)--status:packages:_deb_packages $dds' \
            '(--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' \



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