about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-06-13 17:45:48 +0000
committerClint Adams <clint@users.sourceforge.net>2000-06-13 17:45:48 +0000
commitb4e489407a6b3045a8211810456d161f03816110 (patch)
tree885076f45e1e968075e595e30f7c08ae8aea79f9
parentaab0b4cad008dc4ff4f2a43c59026b2633cf2c7f (diff)
downloadzsh-b4e489407a6b3045a8211810456d161f03816110.tar.gz
zsh-b4e489407a6b3045a8211810456d161f03816110.tar.xz
zsh-b4e489407a6b3045a8211810456d161f03816110.zip
?????: dpkg completion improvements
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Debian/_dpkg54
2 files changed, 44 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index f685b3183..fafa3ca61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-13  Clint Adams  <schizo@debian.org>
+
+	* ?????: Completion/Debian/_dpkg: more intelligence in
+	dpkg completion.
+
 2000-06-13  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 11876: Doc/Zsh/compsys.yo, Src/Zle/computil.c: make -A take a
diff --git a/Completion/Debian/_dpkg b/Completion/Debian/_dpkg
index aa80e6fbc..49de7a6af 100644
--- a/Completion/Debian/_dpkg
+++ b/Completion/Debian/_dpkg
@@ -1,7 +1,8 @@
 #compdef dpkg dpkg-deb
 
 local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
-local curcontext="$curcontext" state line expl ret
+local _dpkg_options_recursive
+local curcontext="$curcontext" context state line expl ret
 typeset -A opt_args
 
 _dpkg_deb_actions=('(--build)-b[build archive]:directory:_files -/' \
@@ -28,7 +29,7 @@ _dpkg_common_actions=('--help[show help]' \
 _dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
            '(-i)--install:*:Debian packages:->install' \
            '--unpack[unpack package]:Debian package:_files -g \*.deb' \
-           '--configure:package:_deb_packages installed' \
+           '--configure:*:package:->configure' \
            '(--remove)-r[remove package]:*:package:->remove' \
            '(-r)--remove:*:package:->remove' \
            '(--purge)-P[purge package]:*:package:->purge' \
@@ -37,8 +38,8 @@ _dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
            '(-p)--print-avail:packages:_deb_packages avail' \
            '--update-avail[update available]:package file:_files' \
            '--merge-avail[merge available]:package file:_files' \
-           '(--record-avail)-A[record available]:package file:_files' \
-           '(-A)--record-avail:package file:_files' \
+           '(--record-avail)-A[record available]:*:package files:->record_avail' \
+           '(-A)--record-avail:*:package files:->record_avail' \
            '--forget-old-unavail[forget uninstalled unavailable]' \
            '--clear-avail[clear available]' \
            '(--list)-l[list packages]:*:packages:->list' \
@@ -57,7 +58,7 @@ _dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
            '--print-architecture[print target architecture]' \
            '--print-gnu-build-architecture[print GNU version of target architecture]' \
            '--print-installation-architecture[print host architecture]' \
-           '--compare-versions[compare version numbers]:expression:')
+           '--compare-versions[compare version numbers]:*:expression:->compare_versions')
 
 _dpkg_options=('--abort-after[abort after errors]:number of errors:' \
            '--admindir=[data directory]:directory:_files -/' \
@@ -79,12 +80,15 @@ _dpkg_options=('--abort-after[abort after errors]:number of errors:' \
            '--ignore-depends=[ignore depends involving package]:package:_deb_packages avail' \
            --{force,refuse,no-force}'--[forcing options]:what:(auto-select downgrade configure-any hold bad-path not-root overwrite overwrite-diverted depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential)')
 
+_dpkg_options_recursive=('(--recursive)-R[recursive]' '(-R)--recursive')
+
 case "${words[1]:t}" in
 dpkg)
 _arguments -C -s "$_dpkg_actions[@]" \
            "$_dpkg_deb_actions[@]" \
            "$_dpkg_common_actions[@]" \
-           "$_dpkg_options[@]"
+           "$_dpkg_options[@]" \
+	   "$_dpkg_options_recursive[@]"
 ;;
 
 dpkg-deb)
@@ -96,19 +100,39 @@ _arguments "$_dpkg_deb_actions[@]" \
 esac
 
 case "$state" in
-  install)
+  install|record_avail)
         _funcall ret _dpkg_$state && return ret
-        _arguments -C -s "$_dpkg_options[@]" \
-	   '*:Debian package:_files -g \*.deb'
-;;
+        _arguments -C -A "-*" -s "$_dpkg_options[@]" \
+	   - recur \
+	   '(--recursive)-R[recursive]' \
+	   '(-R)--recursive' \
+	   ':directory:_files -/' \
+	   - nonrecur \
+	   ':Debian package:_files -g \*.deb'
+  ;;
   remove|purge|status|listfiles)
         _funcall ret _dpkg_$state && return ret
-  	_arguments -C -s "$_dpkg_options[@]" \
+  	_arguments -C -A "-*" -s "$_dpkg_options[@]" \
 	   '*:package:_deb_packages installed'
-;;
+  ;;
   list)
         _funcall ret _dpkg_$state && return ret
-        _arguments -C -s "$_dpkg_options[@]" \
-           '*:packages:_deb_packages avail' \
-;;
+        _arguments -C -A "-*" -s "$_dpkg_options[@]" \
+           '*:packages:_deb_packages avail'
+  ;;
+  compare_versions)
+        _funcall ret _dpkg_$state && return ret
+        _arguments -C -A "-*" -s "$_dpkg_options[@]" \
+	'2:version A:' \
+	'3:operator:(lt le eq ne ge gt lt-nl le-nl ge-nl gt-nl)' \
+	'4:version B:'
+  ;;
+  configure)
+        _funcall ret _dpkg_$state && return ret
+        _arguments -C -A "-*" -s '--configure' \
+	   "$_dpkg_options[@]" \
+	'(--pending)-a[pending packages]' \
+	'(-a)--pending' \
+	'*:package:_deb_packages installed'
+  ;;
 esac