fix: use old auto-completion for 0.9.x compat
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

See toolshed/organising#644

Partial revert of 1f8662cd95
This commit is contained in:
2024-10-27 08:54:43 +01:00
parent 1f9b863be0
commit b313b0a145
4 changed files with 24 additions and 41 deletions

View File

@ -1,26 +1,23 @@
#compdef abra
compdef _abra abra
#compdef $PROG
# https://github.com/urfave/cli/blob/main/autocomplete/zsh_autocomplete
_cli_zsh_autocomplete() {
_abra() {
local -a opts
local cur
cur=${words[-1]}
if [[ "$cur" == "-"* ]]; then
opts=("${(@f)$(${words[@]:0:#words[@]-1} ${cur} --generate-shell-completion)}")
else
opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-shell-completion)}")
fi
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
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi
return
}
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_abra" ]; then
_abra
fi
compdef _cli_zsh_autocomplete $PROG