summaryrefslogtreecommitdiff
path: root/cfgadm/debian/cfgadm.bash-completion
blob: 63198d077520937d7898306ee0cb6743cc19bf29 (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
# *** Public Domain ***
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
export COMP_WORDBREAKS

_cfgadm () {
    local cur prev 
    COMPREPLY=()

    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}

    case "$prev" in
        -c)
        COMPREPLY=( $(compgen -W "insert remove disconnect connect configure unconfigure" -- $cur) )
        ;;
        -s)
        COMPREPLY=( $(compgen -W "select= match= sort= cols= cols2= delim= noheadings" -- "${cur##*,}") )
        local existing_opts=$(expr "$cur" : '\(.*,\)')
        if [[ "$existing_opts" != "" ]]; then
            COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
        fi
        compopt -o nospace
        ;;
        *)
        COMPREPLY=( $(compgen -W "-f -v -h -l -o -s -y -t" -- $cur) )
        ;;
    esac

}

complete -F _cfgadm cfgadm