Skip to content

Commit

Permalink
BUG: ZSH Autocomplete does not work if installed as a file #2955 (#2956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maetveis committed May 14, 2024
1 parent 6e4689d commit ec241ee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions commands/completion-scripts/completion.zsh.gotmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#compdef "{{.App.Name}}"
#compdef {{.App.Name}}

_dnscontrol() {
local -a opts
Expand All @@ -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

0 comments on commit ec241ee

Please sign in to comment.