urfave-cli/autocomplete/zsh_autocomplete

21 lines
419 B
Plaintext
Raw Normal View History

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