about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2002-08-10 17:38:21 +0000
committerClint Adams <clint@users.sourceforge.net>2002-08-10 17:38:21 +0000
commitbbf7efdc834833d22a63cd4b4c89d9e019b0beaa (patch)
treeea1b9b65ae425e89c56577b69254c4b8e3c36759
parent0cdfbb7069bee40e4af0240324cab9d87b2dcbfa (diff)
downloadzsh-bbf7efdc834833d22a63cd4b4c89d9e019b0beaa.tar.gz
zsh-bbf7efdc834833d22a63cd4b4c89d9e019b0beaa.tar.xz
zsh-bbf7efdc834833d22a63cd4b4c89d9e019b0beaa.zip
17206 (Bruno Bonfils), 17207 (Oliver): completion for auto-apt
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Debian/Command/.distfiles1
-rw-r--r--Completion/Debian/Command/_auto-apt57
3 files changed, 65 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 45dcfa4dd..e72bf6882 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-08-10  Clint Adams  <clint@zsh.org>
+
+	* 17206 (Bruno Bonfils), 17207 (Oliver):
+	Completion/Debian/Command/.distfiles,
+	Completion/Debian/Command/_auto-apt: completion for
+	auto-apt, with a couple of _values tweaks.
+
 2002-08-09  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Completion/Debian/Command/.distfiles,
diff --git a/Completion/Debian/Command/.distfiles b/Completion/Debian/Command/.distfiles
index 5156c9717..4b66f5254 100644
--- a/Completion/Debian/Command/.distfiles
+++ b/Completion/Debian/Command/.distfiles
@@ -4,4 +4,5 @@ _apt
 _bts	_bug
 _dpkg       _dpkg_source  _dput  _dupload
 _update-alternatives   _make-kpkg    _debfoster
+_auto-apt
 '
diff --git a/Completion/Debian/Command/_auto-apt b/Completion/Debian/Command/_auto-apt
new file mode 100644
index 000000000..92af817c1
--- /dev/null
+++ b/Completion/Debian/Command/_auto-apt
@@ -0,0 +1,57 @@
+#compdef auto-apt
+
+local expl prev ret
+
+prev="$words[CURRENT-1]"
+
+# if there is a command in arguments ?
+if [[ -n $words[(r)(run|update|update-local|merge|del|check|list|search|debuilt|status)] ]] ; then
+
+    # yes, add completion for command arguments and command options
+    if [[ -n $words[(r)(update|update-local|merge)] && "$words[CURRENT]" = -* ]] ; then
+	_wanted option expl 'option' compadd - "-a" && return 0;
+    fi
+
+    if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then
+	_wanted option expl 'option' compadd - "-v" "-f" && return 0;
+    fi
+
+    case $prev in
+	"run")
+	    _wanted command expl 'command' _files -g '*(/,*)' && return 0 ;;
+	"del")
+	    _wanted package expl 'package' _deb_packages avail && return 0 ;;
+    esac
+else
+    # no, add completion for commands or options (and options arguments)
+    case $prev in 
+	"-a")
+	    local distribs
+	    distribs=("main" "contrib" "non-free" "non-US" "none")
+	    
+	    _values -s , 'distribution' $distribs ;;
+	"-p")
+	    local hooks
+	    hooks=("exec" "open" "access" "stat" "none")
+	    _values -s , 'hook' $hooks ;;
+	"-D")
+	    _wanted file expl 'dbfile' _files ;;
+	"-F")
+	    _wanted file expl 'filedb' _files ;;
+	*)
+	    
+	    local commands options
+	    
+	    commands=("run" "update" "update-local" "merge" "del" "check" "list" "search" "debuild" "status")
+	    options=("-h" "-s" "-y" "-q" "-i" "-X" "-x" "-a" "-p" "-D" "-F" "-L")
+	    
+	    if [[ "$words[CURRENT]" = -* ]] ; then
+		_wanted option expl 'option' compadd - $options
+	    else
+		_wanted command expl 'command' compadd $commands
+	    fi
+	    ;;
+    esac
+
+    return 0
+fi