urfave-cli/autocomplete/zsh_autocomplete

24 lines
488 B
Plaintext
Raw Normal View History

2019-10-06 08:58:51 +00:00
#compdef $PROG
2016-07-20 22:02:16 +00:00
_cli_zsh_autocomplete() {
2014-06-18 15:59:07 +00:00
2016-07-20 22:02:16 +00:00
local -a opts
local cur
cur=${words[-1]}
if [[ "$cur" == "-"* ]]; then
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
else
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
fi
2016-07-20 22:02:16 +00:00
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi
2016-07-20 22:02:16 +00:00
return
}
compdef _cli_zsh_autocomplete $PROG