| 1 |
#compdef %[1]s |
| 2 |
compdef _%[1]s %[1]s |
| 3 |
|
| 4 |
# This is a shell completion script auto-generated by https://github.com/urfave/cli for zsh. |
| 5 |
|
| 6 |
_%[1]s() { |
| 7 |
local -a opts # Declare a local array |
| 8 |
local current |
| 9 |
current=${words[-1]} # -1 means "the last element" |
| 10 |
if [[ "$current" == "-"* ]]; then |
| 11 |
# Current word starts with a hyphen, so complete flags/options |
| 12 |
opts=("${(@f)$(${words[@]:0:#words[@]-1} ${current} --generate-shell-completion)}") |
| 13 |
else |
| 14 |
# Current word does not start with a hyphen, so complete subcommands |
| 15 |
opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-shell-completion)}") |
| 16 |
fi |
| 17 |
|
| 18 |
if [[ "${opts[1]}" != "" ]]; then |
| 19 |
_describe 'values' opts |
| 20 |
else |
| 21 |
_files |
| 22 |
fi |
| 23 |
} |
| 24 |
|
| 25 |
# Don't run the completion function when being source-ed or eval-ed. |
| 26 |
# See https://github.com/urfave/cli/issues/1874 for discussion. |
| 27 |
if [ "$funcstack[1]" = "_%[1]s" ]; then |
| 28 |
_%[1]s |
| 29 |
fi |