Skip to content

Commit 86d8407

Browse files
authored
Merge pull request #1133 from oleorhagen/zshbackport
Backport zsh_autocomplete from master to the v1 branch
2 parents 1e44266 + 0703fa9 commit 86d8407

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

autocomplete/zsh_autocomplete

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33
_cli_zsh_autocomplete() {
44

55
local -a opts
6-
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
6+
local cur
7+
cur=${words[-1]}
8+
if [[ "$cur" == "-"* ]]; then
9+
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
10+
else
11+
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
12+
fi
713

8-
_describe 'values' opts
14+
if [[ "${opts[1]}" != "" ]]; then
15+
_describe 'values' opts
16+
else
17+
_files
18+
fi
919

1020
return
1121
}

0 commit comments

Comments
 (0)