From b84399b9cbb93f199d695d7cb264c44178a8d5e0 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 31 Jul 2003 15:26:13 +0000 Subject: tidy up of many completions (updates, fixes, improvements and plain aesthetics) --- Completion/Debian/Command/_auto-apt | 68 ++++++++++++------------------------- 1 file changed, 21 insertions(+), 47 deletions(-) (limited to 'Completion/Debian/Command/_auto-apt') diff --git a/Completion/Debian/Command/_auto-apt b/Completion/Debian/Command/_auto-apt index 92af817c1..2e6dccbc1 100644 --- a/Completion/Debian/Command/_auto-apt +++ b/Completion/Debian/Command/_auto-apt @@ -1,57 +1,31 @@ #compdef auto-apt -local expl prev ret - -prev="$words[CURRENT-1]" +local expl 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 + # 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; + fi - if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then - _wanted option expl 'option' compadd - "-v" "-f" && return 0; - fi + if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then + _wanted option expl 'option' compadd - "-v" "-f" && return; + fi - case $prev in - "run") - _wanted command expl 'command' _files -g '*(/,*)' && return 0 ;; - "del") - _wanted package expl 'package' _deb_packages avail && return 0 ;; - esac + case $prev in + run) _wanted command expl 'command' _files -g '*(/,*)' && return ;; + del) _wanted package expl 'package' _deb_packages avail && return ;; + 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 + _arguments \ + '-a:distribution:_values -s , distribution main contrib non-free non-US none' \ + '-p:hook:_values -s , hook exec open access stat none' \ + '-D:dbfile:_files' \ + '-F:filedb:_files' \ + -h -s -y -q -i -X -x -L \ + '*:command:(run update update-local merge del check list search debuild status)' && return fi + +return 1 -- cgit 1.4.1