1#compdef wajig 2 3local curcontext="$curcontext" state line cmds argno ret=1 4 5_arguments -C -s \ 6 '(- 1 *)'{-h,--help}'[print usage message]' \ 7 '(- 1 *)--version[display version information]' \ 8 '(-q --quiet)'{-q,--quiet}'[do everything quietly]' \ 9 '(-s --simulate)'{-s,--simulate}"[trace but don't execute]" \ 10 '(-t --teaching)'{-t,--teaching}'[trace the sequence of commands performed]' \ 11 '(-v --verbose)'{-v,--verbose}'[increase (or set) the level of verbosity]' \ 12 '1: :->cmds' \ 13 '*: :->args' && ret=0 14 15case $state in 16 cmds) 17 cmds=( ${${(M)${(f)"$(wajig commands 2>/dev/null)"}:# [^-]*}/(#b) ([^ ]#) #(*)/$match[1]:$match[2]:l} ) 18 19 _describe -t commands 'wajig command' cmds && ret=0 20 ;; 21 args) 22 (( argno = $#line-1 )) 23 case ${line[1]:gs/-/} in 24 autoalts|autoalternatives|updatealts) 25 ((argno==1)) && _wanted alternatives expl alternative \ 26 _files -W /var/lib/dpkg/alternatives && ret=0 27 ;; 28 listfiles|repackage|package) 29 ((argno==1)) || break 30 ;& 31 hold|large|readme|reconfigure|reinstall|remove|removedepend|showremove|size?|upgrade) 32 _wanted package expl 'package' _deb_packages installed && ret=0 33 ;; 34 purgedepend) 35 ((argno==1)) && _wanted package expl 'package' _deb_packages xinstalled && ret=0 36 ;; 37 purge) 38 _wanted package expl 'package' _deb_packages xinstalled && ret=0 39 ;; 40 autoinstall|force|showinstall|installr|recommended|installrs|installs|suggested|install/*) 41 _wanted package expl 'package' _deb_packages uninstalled && ret=0 42 ;; 43 install) 44 _alternative \ 45 'packages:package:_deb_packages uninstalled' \ 46 'files:package file:_files -g "*.deb(-.)"' && ret=0 47 ;; 48 bug|bugs|dependents|geturl) 49 ((argno==1)) || break 50 ;& 51 available|build|builddepend|changelog|describe|whatis|detail|details|show|news|policy|download|source|status|recdownload) 52 _wanted package expl 'package' _deb_packages available && ret=0 53 ;; 54 unhold) 55 _wanted package expl 'package' _deb_packages held && ret=0 56 ;; 57 filedownload|downloadfile|fileinstall|installfile|fileremove|removefile|indfile) 58 ((argno==1)) && _files && ret=0 59 ;; 60 whichpkg) 61 _files 62 ;; 63 rpminstall|rpmtodeb|rpm2deb) 64 ((argno==1)) && _files -g '*.rpm(-.)' && ret=0 65 ;; 66 searchapt) 67 _wanted distributions expl distribution \ 68 compadd stable testing unstable && ret=0 69 ;; 70 reload|restart|start|stop) 71 ((argno==1)) && _services && ret=0 72 ;; 73 esac 74 ;; 75esac 76 77return ret 78