summaryrefslogtreecommitdiffstats
path: root/completions/tcpdump
blob: 9a7c2e9ccce8ffbae3e14a1fe94c595a8f5bcd76 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# bash completion for tcpdump                              -*- shell-script -*-

_tcpdump()
{
    local cur prev words cword split
    _init_completion -s || return

    case $prev in
        -!(-*)[rwFV])
            _filedir
            return
            ;;
        --interface | -!(-*)i)
            _available_interfaces -a
            return
            ;;
        -!(-*)m)
            _filedir mib
            return
            ;;
        -!(-*)T)
            COMPREPLY=($(compgen -W 'aodv carp cnfp lmp pgm pgm_zmtp1 radius
                resp rpc rtcp rtp rtcp snmp tftp vat vxlan wb zmtp1' \
                -- "$cur"))
            return
            ;;
        -!(-*)z)
            compopt -o filenames
            COMPREPLY=($(compgen -c -- "$cur"))
            return
            ;;
        --relinquish-privileges | -!(-*)Z)
            _allowed_users
            return
            ;;
        -!(-*)[BcCDEGMsWy])
            return
            ;;
        --time-stamp-type | -!(-*)j)
            COMPREPLY=($(compgen -W 'host host_lowprec host_hiprec adapter
                adapter_unsynced' -- "$cur"))
            return
            ;;
        --direction | -!(-*)Q)
            COMPREPLY=($(compgen -W 'in out inout' -- "$cur"))
            return
            ;;
        --time-stamp-precision)
            COMPREPLY=($(compgen -W 'micro nano' -- "$cur"))
            return
            ;;
    esac

    $split && return

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur"))
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
    fi

} &&
    complete -F _tcpdump tcpdump

# ex: filetype=sh