BUG: ZSH Autocomplete does not work if installed as a file #2955 (#2956)

This commit is contained in:
Mészáros Gergely 2024-05-14 14:47:01 +02:00 committed by GitHub
parent 6e4689dc13
commit ec241eea1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
#compdef "{{.App.Name}}"
#compdef {{.App.Name}}
_dnscontrol() {
local -a opts
@ -17,4 +17,12 @@ _dnscontrol() {
fi
}
compdef "_dnscontrol" "{{.App.Name}}"
# Run the function the first time we are auto-loaded, otherwise the very first
# complete wouldn't work in each shell session
# Otherwise assume we are directly sourced and register the completion
# (This is done by the #compdef directive in the autoloaded case.)
if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then
_dnscontrol "$@"
else
compdef "_dnscontrol" "dnscontrol"
fi