Skip to content

Commit

Permalink
backport(autocomplete): Sync the zsh_autocomplete file with master
Browse files Browse the repository at this point in the history
Some bug fixes have been added to master for the zsh_autocomplete function.
Backport this to make it available for v1 also.

Changelog: None

Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
  • Loading branch information
Ole Petter committed May 5, 2020
1 parent 1e44266 commit 0703fa9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions autocomplete/zsh_autocomplete
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
_cli_zsh_autocomplete() {

local -a opts
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
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

_describe 'values' opts
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi

return
}
Expand Down

0 comments on commit 0703fa9

Please sign in to comment.