#compdef tmplt autoload -U is-at-least _tmplt() { typeset -A opt_args typeset -a _arguments_options local ret=1 if is-at-least 5.2; then _arguments_options=(-s -S -C) else _arguments_options=(-s -C) fi local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ ":: :_tmplt_commands" \ "*::: :->tmplt" \ && ret=0 case $state in (tmplt) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:tmplt-command-$line[1]:" case $line[1] in (new) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ '*::args:' \ && ret=0 ;; (init) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ '*::args:' \ && ret=0 ;; (import) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ '*::args:' \ && ret=0 ;; (list) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (remove) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ '*::args:' \ && ret=0 ;; (version) _arguments "${_arguments_options[@]}" \ '-h[Print help]' \ '--help[Print help]' \ '*::args:' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ ":: :_tmplt__help_commands" \ "*::: :->help" \ && ret=0 case $state in (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:tmplt-help-command-$line[1]:" case $line[1] in (new) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (init) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (import) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (list) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (remove) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (version) _arguments "${_arguments_options[@]}" \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ && ret=0 ;; esac ;; esac ;; esac ;; esac } (( $+functions[_tmplt_commands] )) || _tmplt_commands() { local commands; commands=( 'new:Create a new project' \ 'init:Create a new template' \ 'import:Import a template' \ 'list:List all templates' \ 'remove:Remove a template' \ 'version:Show version' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'tmplt commands' commands "$@" } (( $+functions[_tmplt__help_commands] )) || _tmplt__help_commands() { local commands; commands=( 'new:Create a new project' \ 'init:Create a new template' \ 'import:Import a template' \ 'list:List all templates' \ 'remove:Remove a template' \ 'version:Show version' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'tmplt help commands' commands "$@" } (( $+functions[_tmplt__help__help_commands] )) || _tmplt__help__help_commands() { local commands; commands=() _describe -t commands 'tmplt help help commands' commands "$@" } (( $+functions[_tmplt__help__import_commands] )) || _tmplt__help__import_commands() { local commands; commands=() _describe -t commands 'tmplt help import commands' commands "$@" } (( $+functions[_tmplt__import_commands] )) || _tmplt__import_commands() { local commands; commands=() _describe -t commands 'tmplt import commands' commands "$@" } (( $+functions[_tmplt__help__init_commands] )) || _tmplt__help__init_commands() { local commands; commands=() _describe -t commands 'tmplt help init commands' commands "$@" } (( $+functions[_tmplt__init_commands] )) || _tmplt__init_commands() { local commands; commands=() _describe -t commands 'tmplt init commands' commands "$@" } (( $+functions[_tmplt__help__list_commands] )) || _tmplt__help__list_commands() { local commands; commands=() _describe -t commands 'tmplt help list commands' commands "$@" } (( $+functions[_tmplt__list_commands] )) || _tmplt__list_commands() { local commands; commands=() _describe -t commands 'tmplt list commands' commands "$@" } (( $+functions[_tmplt__help__new_commands] )) || _tmplt__help__new_commands() { local commands; commands=() _describe -t commands 'tmplt help new commands' commands "$@" } (( $+functions[_tmplt__new_commands] )) || _tmplt__new_commands() { local commands; commands=() _describe -t commands 'tmplt new commands' commands "$@" } (( $+functions[_tmplt__help__remove_commands] )) || _tmplt__help__remove_commands() { local commands; commands=() _describe -t commands 'tmplt help remove commands' commands "$@" } (( $+functions[_tmplt__remove_commands] )) || _tmplt__remove_commands() { local commands; commands=() _describe -t commands 'tmplt remove commands' commands "$@" } (( $+functions[_tmplt__help__version_commands] )) || _tmplt__help__version_commands() { local commands; commands=() _describe -t commands 'tmplt help version commands' commands "$@" } (( $+functions[_tmplt__version_commands] )) || _tmplt__version_commands() { local commands; commands=() _describe -t commands 'tmplt version commands' commands "$@" } if [ "$funcstack[1]" = "_tmplt" ]; then _tmplt "$@" else compdef _tmplt tmplt fi