1#compdef my-app 2 3autoload -U is-at-least 4 5_my-app() { 6 typeset -A opt_args 7 typeset -a _arguments_options 8 local ret=1 9 10 if is-at-least 5.2; then 11 _arguments_options=(-s -S -C) 12 else 13 _arguments_options=(-s -C) 14 fi 15 16 local context curcontext="$curcontext" state line 17 _arguments "${_arguments_options[@]}" \ 18'--choice=[]: :(bash fish zsh)' \ 19'--unknown=[]: : ' \ 20'--other=[]: :( )' \ 21'-p+[]: :_files' \ 22'--path=[]: :_files' \ 23'-f+[]: :_files' \ 24'--file=[]: :_files' \ 25'-d+[]: :_files -/' \ 26'--dir=[]: :_files -/' \ 27'-e+[]: :_absolute_command_paths' \ 28'--exe=[]: :_absolute_command_paths' \ 29'--cmd-name=[]: :_command_names -e' \ 30'-c+[]: :_cmdstring' \ 31'--cmd=[]: :_cmdstring' \ 32'-u+[]: :_users' \ 33'--user=[]: :_users' \ 34'-H+[]: :_hosts' \ 35'--host=[]: :_hosts' \ 36'--url=[]: :_urls' \ 37'--email=[]: :_email_addresses' \ 38'-h[Print help]' \ 39'--help[Print help]' \ 40'*::command_with_args:_cmdambivalent' \ 41&& ret=0 42} 43 44(( $+functions[_my-app_commands] )) || 45_my-app_commands() { 46 local commands; commands=() 47 _describe -t commands 'my-app commands' commands "$@" 48} 49 50if [ "$funcstack[1]" = "_my-app" ]; then 51 _my-app "$@" 52else 53 compdef _my-app my-app 54fi 55