3 # Bruno Bonfils, <asyd@zshfr.org>
7 prev="$words[CURRENT-1]"
9 # if there is a command in arguments ?
10 if [[ -n $words[(r)(run|update|update-local|merge|del|check|list|search|debuilt|status)] ]] ; then
12 # yes, add completion for command arguments and command options
13 if [[ -n $words[(r)(update|update-local|merge)] && "$words[CURRENT]" = -* ]] ; then
14 _wanted option expl 'option' compadd - "-a" && return 0;
17 if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then
18 _wanted option expl 'option' compadd - "-v" "-f" && return 0;
23 _wanted command expl 'command' _files -g '*(/,*)' && return 0 ;;
25 _wanted package expl 'package' _deb_packages avail && return 0 ;;
27 _arguments ':pattern:' && return 0 ;;
32 # no, add completion for commands or options (and options arguments)
38 distribs=("main" "contrib" "non-free" "non-US" "none")
40 _wanted distribution expl 'distribution' compadd -q -S, $distribs ;;
43 hooks=("exec" "open" "access" "stat" "none")
44 _wanted hook expl 'hook' compadd -q -S, $hooks ;;
46 _wanted file expl 'dbfile' _files ;;
48 _wanted file expl 'filedb' _files ;;
51 local commands options
53 commands=("run" "update" "update-local" "merge" "del" "check" "list" "search" "debuild" "status")
54 options=("-h" "-s" "-y" "-q" "-i" "-X" "-x" "-a" "-p" "-D" "-F" "-L")
56 if [[ "$words[CURRENT]" = -* ]] ; then
57 _wanted option expl 'option' compadd - $options
59 _wanted command expl 'command' compadd $commands