dnscontrol/commands/completion-scripts/completion.zsh.gotmpl
Tom Whitwell b91bcf373f
Add Shell Completion script generation
`dnsutils shell-completion <shell>` will generate a shell completion
script for the specified shell (bash or zsh). If no shell is specified,
the script will be generated for the current shell, using `$SHELL`.
2023-10-15 11:12:28 +01:00

20 lines
421 B
Go Template

#compdef "{{.App.Name}}"
_dnscontrol() {
local -a opts
local cur
cur=${words[-1]}
if [[ "$cur" == "-"* ]]; then
opts=("${(@f)$(${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
else
opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-bash-completion)}")
fi
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi
}
compdef "_dnscontrol" "{{.App.Name}}"