about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Debian/Command/_dpkg52
2 files changed, 45 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 21020392b..5fa82e7e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-07  Clint Adams  <clint@zsh.org>
+
+	* Jesse Weinstein: 21233: Completion/Debian/Command/_dpkg:
+	completion for dpkg-query.
+
 2005-05-06  Bart Schaefer  <schaefer@zsh.org>
 
 	* 21229: Doc/Makefile.in: fix fake build run when yodl isn't found
diff --git a/Completion/Debian/Command/_dpkg b/Completion/Debian/Command/_dpkg
index 3d602bff8..770130e53 100644
--- a/Completion/Debian/Command/_dpkg
+++ b/Completion/Debian/Command/_dpkg
@@ -1,13 +1,19 @@
-#compdef dpkg dpkg-deb dpkg-reconfigure
+#compdef dpkg dpkg-deb dpkg-query dpkg-reconfigure
 
 local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
-local _dpkg_options_recursive _dpkg_actions_install _dpkg_actions_record_avail
+local _dpkg_options_recursive #_dpkg_actions_install _dpkg_actions_record_avail
 local _dpkg_deb_only_actions
+local _dpkg_deb_and_query_only_actions _dpkg_deb_and_query_only_options 
+local _dpkg_query_actions
 local curcontext="$curcontext" context state line expl ret
 typeset -A opt_args
 
 _dpkg_deb_only_actions=(
-  '(--show -W)'{--show,-W}'[show package info]:Debian package:_files -g \*.u\#deb'
+    '-D[debugging output]'
+    '(--new)--old[old archive format]'
+    '(--old)--new[new archive format]'
+    '--nocheck[suppress control file check]'
+    '-z+[compression level]:compression number:(1 2 3 4 5 6 7 8 9)'
 )
 
 _dpkg_deb_actions=(
@@ -33,20 +39,15 @@ _dpkg_actions=(
   '--configure[reconfigure specified packages]:*:package:->configure'
   '(--remove -r)'{--remove,-r}'[remove package]:*:package:->remove'
   '(--purge -P)'{--purge,-P}'[purge package]:*:package:->purge'
-  '(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail'
   '--update-avail[update available]:package file:_files'
   '--merge-avail[merge available]:package file:_files'
   '(--record-avail -A)'{--record-avail,-A}'[record available]:*:package files:->record_avail'
   '--forget-old-unavail[forget uninstalled unavailable]'
   '--clear-avail[clear available]'
-  '(--list -l)'{--list,-l}'[list packages]:*:packages:->list'
-  '(--status -s)'{--status,-s}'[display package status]:*:packages:->status'
   '(--audit -C)'{--audit,-C}'[check for broken pkgs]'
   '--get-selections[get selections]:pattern:'
   '--set-selections[set selections]'
   '--yet-to-unpack[list uninstalled]'
-  '(--listfiles, -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
-  '(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search'
   '--print-architecture[print target architecture]'
   '--print-gnu-build-architecture'
   '--print-installation-architecture'
@@ -55,7 +56,6 @@ _dpkg_actions=(
 
 _dpkg_options=(
   '--abort-after[abort after errors]:number of errors:'
-  '--admindir=[data directory]:directory:_files -/'
   '--root=[alternative root]:root:_files -/'
   '--instdir=[change inst root but not data dir]:_files -/'
   '(--selected-only -O)'{--selected-only,-O}'[skip unselected packages]'
@@ -73,6 +73,23 @@ _dpkg_options=(
 
 _dpkg_options_recursive=( '(--recursive -R)'{--recursive,-R}'[recursive]' )
 
+_dpkg_deb_and_query_only_actions=(
+    '(--show -W)'{--show,-W}'[show package info]:Debian package:_files -g \*.u\#deb'
+)
+
+_dpkg_deb_and_query_only_options=(
+    '--showformat=-[alternative format]:format: '
+)
+
+_dpkg_query_actions=(
+      '(--status -s)'{--status,-s}'[display package status]:*:packages:->status'
+      '(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail'
+      '(--listfiles, -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
+      '(--list -l)'{--list,-l}'[list packages]:*:packages:->list'
+      '(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search'
+      '--admindir=[data directory]:directory:_files -/'
+)
+
 # not needed anymore?
 #  _dpkg_actions_install=('(--install)-i[install]' '(-i)--install')
 #  _dpkg_actions_record_avail=('(--record-avail)-A[record available]' '(-A)--record-avail')
@@ -84,13 +101,24 @@ case "$service" in
       "$_dpkg_deb_actions[@]" \
       "$_dpkg_common_actions[@]" \
       "$_dpkg_options[@]" \
-      "$_dpkg_options_recursive[@]" && return 0
+      "$_dpkg_options_recursive[@]" \
+      "$_dpkg_query_actions[@]" && return 0
   ;;
 
   dpkg-deb)
     _arguments "$_dpkg_deb_actions[@]" \
-	"$_dpkg_deb_only_actions[@]" \
-	"$_dpkg_common_actions[@]" && return 0
+        "$_dpkg_deb_only_actions[@]" \
+        "$_dpkg_common_actions[@]" \
+        "$_dpkg_deb_and_query_only_actions[@]" \
+        "$_dpkg_deb_and_query_only_options[@]" && return 0
+
+  ;;
+
+  dpkg-query)
+    _arguments "$_dpkg_query_actions[@]" \
+           "$_dpkg_common_actions[@]" \
+           "$_dpkg_deb_and_query_only_actions[@]" \
+           "$_dpkg_deb_and_query_only_options[@]" && return 0
   ;;
   dpkg-reconfigure)
     _arguments -sw \