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