mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-10 17:38:13 +08:00
b91bcf373f
`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`.
20 lines
421 B
Go Template
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}}"
|