1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
# nsd-control(1) completion -*- shell-script -*-
_nsdcontrol()
{
local cur prev words cword
_init_completion || return
local WORDS
case $prev in
assoc_tsig|\
changezone|\
delzone|\
force_transfer|\
notify|\
reload|\
transfer|\
write|\
zonestatus)
WORDS=$($1 zonestatus |awk '/zone:/ {print $2}' ORS=' ')
COMPREPLY=($(compgen -W "$WORDS" -- "$cur"))
return 0
;;
esac
if [[ $cur == -* ]]; then
WORDS=$($1 |awk '/^ -/ {print $1}' ORS=' ')
elif ((cword == 1)); then
WORDS=$($1 |awk '/^ [^-]/ {print $1}' ORS=' ')
fi
COMPREPLY=($(compgen -W "$WORDS" -- "$cur"))
} &&
complete -F _nsdcontrol nsd-control
# ex: filetype=sh
|