about summary refs log tree commit diff
path: root/Completion/Debian/_apt-get
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-03 23:19:14 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-03 23:19:14 +0000
commit5fcfd1f07e71f24d4a43cac970ec39b514154d69 (patch)
treecc03ca70db88b8dbb1ec5e96164c46948bbeeb54 /Completion/Debian/_apt-get
parentcef45cd543c1c8ac2da327803ac878a87435329f (diff)
downloadzsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.tar.gz
zsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.tar.xz
zsh-5fcfd1f07e71f24d4a43cac970ec39b514154d69.zip
zsh-workers/7641
Diffstat (limited to 'Completion/Debian/_apt-get')
-rw-r--r--Completion/Debian/_apt-get59
1 files changed, 38 insertions, 21 deletions
diff --git a/Completion/Debian/_apt-get b/Completion/Debian/_apt-get
index 90e777246..12ab30bc7 100644
--- a/Completion/Debian/_apt-get
+++ b/Completion/Debian/_apt-get
@@ -1,23 +1,40 @@
 #compdef apt-get
 
-_arguments -s \
-  -{,-no-}d --{,no-}download-only \
-  -{,-no-}f --{,no-}fix-broken \
-  -{,-no-}h --{,no-}help \
-  -{,-no-}v --{,no-}version \
-  -{,-no-}m --{,no-}ignore-missing \
-  --{,no-}fix-missing \
-  --{,no-}no-download \
-  \*-{,-no-}q \*--{,no-}{quiet,silent} \
-  -{,-no-}s --{,no-}{simulate,just-print,dry-run,recon,no-act} \
-  -{,-no-}y --{,no-}{yes,assume-yes} \
-  -{,-no-}u --{,no-}show-upgraded \
-  -{,-no-}b --{,no-}{compile,build} \
-  --{,no-}ignore-hold \
-  --{,no-}no-upgrade \
-  --{,no-}force-yes \
-  --{,no-}print-uris \
-  {-{,-no-}c,--{,no-}config-file}':Configuration File:_files' \
-  {-o,--option}':Foo\:\:Bar=bar:' \
-  ':command:(update upgrade dselect-upgrade dist-upgrade install remove source check clean autoclean help)' \
-  '*:package:_deb_packages'
+_apt-get () {
+  # This doesn't handle command line of apt completely since command line
+  # parsing library for apt is too complex to handle by _arguments.
+  _arguments -s \
+    -{,-no-}d --{,no-}download-only \
+    -{,-no-}f --{,no-}fix-broken \
+    -{,-no-}h --{,no-}help \
+    -{,-no-}v --{,no-}version \
+    -{,-no-}m --{,no-}ignore-missing \
+    --{,no-}fix-missing \
+    --{,no-}no-download \
+    \*-{,-no-}q \*--{,no-}{quiet,silent} \
+    -{,-no-}s --{,no-}{simulate,just-print,dry-run,recon,no-act} \
+    -{,-no-}y --{,no-}{yes,assume-yes} \
+    -{,-no-}u --{,no-}show-upgraded \
+    -{,-no-}b --{,no-}{compile,build} \
+    --{,no-}ignore-hold \
+    --{,no-}no-upgrade \
+    --{,no-}force-yes \
+    --{,no-}print-uris \
+    {-{,-no-}c,--{,no-}config-file}':Configuration File:_files' \
+    {-o,--option}':Foo\:\:Bar=bar:' \
+    '*::command and packages:_apt-get_args'
+}
+
+_apt-get_args () {
+  if (( CURRENT == 1 )); then
+    compadd "$@" - update upgrade dselect-upgrade dist-upgrade install remove source check clean autoclean help
+  else
+    case "$words[1]" in
+      install) _deb_packages uninstalled "$@";;
+      remove) _deb_packages installed "$@";;
+      *) _deb_packages avail "$@";;
+    esac
+  fi
+}
+
+_apt-get "$@"