about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-06-04 18:32:19 +0000
committerClint Adams <clint@users.sourceforge.net>2000-06-04 18:32:19 +0000
commitbac12ab6ff84a0cd7c952e5ab2fb7595a93d182d (patch)
tree789a16e615e4b3234d9a38c486c5d6079e005144
parent360abc7d0fe2307a2ef9edbb6195d17ef19cc798 (diff)
downloadzsh-bac12ab6ff84a0cd7c952e5ab2fb7595a93d182d.tar.gz
zsh-bac12ab6ff84a0cd7c952e5ab2fb7595a93d182d.tar.xz
zsh-bac12ab6ff84a0cd7c952e5ab2fb7595a93d182d.zip
11739: _dpkg improvements
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Debian/_dpkg94
2 files changed, 67 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index c819c2d92..5691a4bb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-04  Clint Adams  <schizo@debian.org>
+
+	* 11739: Completion/Debian/_dpkg: complete multiple arguments
+	for -i, -r, -P, -l, -L, -s, -S.  _funcalls for the
+	newly-introduced states.
+
 2000-06-03  Bart Schaefer  <schaefer@zsh.org>
 
 	* 11737: Src/Makefile.in: Remove modules.index and modules-bltin
diff --git a/Completion/Debian/_dpkg b/Completion/Debian/_dpkg
index 43325c636..aa80e6fbc 100644
--- a/Completion/Debian/_dpkg
+++ b/Completion/Debian/_dpkg
@@ -1,6 +1,10 @@
 #compdef dpkg dpkg-deb
 
-_dpkg_deb_args=('(--build)-b[build archive]:directory:_files -/' \
+local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
+local curcontext="$curcontext" state line expl ret
+typeset -A opt_args
+
+_dpkg_deb_actions=('(--build)-b[build archive]:directory:_files -/' \
            '(-b)--build:directory:_files -/' \
            '(--contents)-c[list contents]:Debian package:_files -g \*.deb' \
            '(-c)--contents:Debian package:_files -g \*.deb' \
@@ -16,45 +20,46 @@ _dpkg_deb_args=('(--build)-b[build archive]:directory:_files -/' \
            '(-X)--vextract[extract and list]:Debian package:_files -g \*.deb' \
            '--fsys-tarfile[output fs tarfile]:Debian package:_files -g \*.deb')
 
-_dpkg_common_args=('--help[show help]' \
+_dpkg_common_actions=('--help[show help]' \
            '--version[show version]' \
-           '--licence[show licensing]')
+           '(--license)--licence[show licencing]' \
+           '(--licence)--license[show licensing]')
 
-case "${words[1]:t}" in
-dpkg)
-_arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb' \
-           '(-i)--install:Debian package:_files -g \*.deb' \
+_dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
+           '(-i)--install:*:Debian packages:->install' \
            '--unpack[unpack package]:Debian package:_files -g \*.deb' \
-           '(--record-avail)-A[record available]:package file:_files' \
-           '(-A)--record-avail:package file:_files' \
            '--configure:package:_deb_packages installed' \
-           '(--remove)-r[remove package]:package:_deb_packages installed' \
-           '(-r)--remove:package:_deb_packages installed' \
-           '(--purge)-P[purge package]:package:_deb_packages installed' \
-           '(-P)--purge:package:_deb_packages installed' \
-           '--get-selections[get selections]:pattern:' \
-           '--set-selections[set selections]' \
+           '(--remove)-r[remove package]:*:package:->remove' \
+           '(-r)--remove:*:package:->remove' \
+           '(--purge)-P[purge package]:*:package:->purge' \
+           '(-P)--purge:*:package:->purge' \
+           '(--print-avail)-p[display available details]:packages:_deb_packages avail' \
+           '(-p)--print-avail:packages:_deb_packages avail' \
            '--update-avail[update available]:package file:_files' \
            '--merge-avail[merge available]:package file:_files' \
-           '--clear-avail[clear available]' \
+           '(--record-avail)-A[record available]:package file:_files' \
+           '(-A)--record-avail:package file:_files' \
            '--forget-old-unavail[forget uninstalled unavailable]' \
-           '(--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' \
-           '(-L)--listfiles:packages:_deb_packages installed' \
-           '(--list)-l[list packages]:packages:_deb_packages avail' \
-           '(-l)--list:packages:_deb_packages avail' \
-           '(--search)-S[search for file owner]:pattern:_files' \
-           '(-S)--search:pattern:_files' \
+           '--clear-avail[clear available]' \
+           '(--list)-l[list packages]:*:packages:->list' \
+           '(-l)--list:*:packages:->list' \
+           '(--status)-s[display package status]:*:packages:->status' \
+           '(-s)--status:*:packages:->status' \
            '(--audit)-C[check for broken pkgs]' \
            '(-C)--audit' \
-           '--abort-after[abort after errors]:number of errors:' \
+           '--get-selections[get selections]:pattern:' \
+           '--set-selections[set selections]' \
+	   '--yet-to-unpack[list uninstalled]' \
+           '(--listfiles)-L[list owned files]:*:packages:->listfiles' \
+           '(-L)--listfiles:*:packages:->listfiles' \
+           '(--search)-S[search for file owner]:*:pattern:->search' \
+           '(-S)--search:*:pattern:->search' \
            '--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:')
+
+_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 -/' \
@@ -72,15 +77,38 @@ _arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb'
            '-D+[debug options]:debug options:(h 1 2 3)' \
            '--debug=[debug options]:debug options:(help 1 2 3)' \
            '--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_deb_args[@]" \
-           "$_dpkg_common_args[@]"
+           --{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)')
+
+case "${words[1]:t}" in
+dpkg)
+_arguments -C -s "$_dpkg_actions[@]" \
+           "$_dpkg_deb_actions[@]" \
+           "$_dpkg_common_actions[@]" \
+           "$_dpkg_options[@]"
 ;;
 
 dpkg-deb)
-_arguments "$_dpkg_deb_args[@]" \
-           "$_dpkg_common_args[@]"
+_arguments "$_dpkg_deb_actions[@]" \
+           "$_dpkg_common_actions[@]"
 
 ;;
 
 esac
+
+case "$state" in
+  install)
+        _funcall ret _dpkg_$state && return ret
+        _arguments -C -s "$_dpkg_options[@]" \
+	   '*:Debian package:_files -g \*.deb'
+;;
+  remove|purge|status|listfiles)
+        _funcall ret _dpkg_$state && return ret
+  	_arguments -C -s "$_dpkg_options[@]" \
+	   '*:package:_deb_packages installed'
+;;
+  list)
+        _funcall ret _dpkg_$state && return ret
+        _arguments -C -s "$_dpkg_options[@]" \
+           '*:packages:_deb_packages avail' \
+;;
+esac