File: autocomplete_nsd-control.bash

package info (click to toggle)
nsd 4.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,188 kB
  • sloc: ansic: 64,639; sh: 4,523; python: 2,085; yacc: 1,344; makefile: 688
file content (35 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (2)
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