1#compdef vim-addons 2 3local state line cmds ret=1 4typeset -A opt_args 5 6_arguments -C \ 7 {-q,--query}'[be quiet and make the output more parseable]' \ 8 {-r,--registry-dir}'[set the registry directory]' \ 9 {-s,--source-dir}'[set addon source directory]' \ 10 {-t,--target-dir}'[set addon target directory]' \ 11 {-v,--verbose}'[increase verbosity]' \ 12 {-y,--system-dir}'[set system-wide target directory]' \ 13 {-h,--help}'[help]' \ 14 {-w,--system-wide}'[set target directory to the system-wide one (overrides -t)]' \ 15 '1: :->cmds' \ 16 '*: :->args' && ret=0 17 18case $state in 19 cmds) 20 cmds=( 21 'install:install the specified addon' 22 'remove:remove the specified addon' 23 'list:list available addons in registry' 24 'status:list the status of addons' 25 'disable:disable the specified addons' 26 'amend:under the effects of the previous disable' 27 'files:list the files composing the specified addon' 28 'show:display detailed information about the specified addon' 29 ) 30 _describe -t commands 'vim-addons command' cmds && ret=0 31 ;; 32 args) 33 case $line[1] in 34 install) 35 _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "removed" { print $1 }') && ret=0 36 ;; 37 amend) 38 _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "disabled" { print $1 }') && ret=0 39 ;; 40 remove) 41 _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 ~ /disabled|installed/ { print $1 }') && ret=0 42 ;; 43 files|status|disable|show) 44 _wanted addon expl 'addon' compadd $(command vim-addons list) && ret=0 45 ;; 46 esac 47 ;; 48esac 49 50return ret 51