summaryrefslogtreecommitdiffstats
path: root/completions/postconf
blob: ac1b21b39b1c429bb3a7aa365e84be7ae5fb2933 (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
# postconf(1) completion                                   -*- shell-script -*-

_comp_cmd_postconf()
{
    local cur prev words cword comp_args
    _comp_initialize -- "$@" || return

    local eqext

    case $prev in
        -b | -t)
            _comp_compgen_filedir
            return
            ;;
        -c)
            _comp_compgen_filedir -d
            return
            ;;
        -e)
            cur=${cur#[\"\']}
            eqext='='
            ;;
    esac

    if [[ $cur == -* ]]; then
        _comp_compgen_usage
        return
    fi

    local len=${#cur} pval
    for pval in $(/usr/sbin/postconf 2>/dev/null | cut -d ' ' -f 1); do
        if [[ $cur == "${pval:0:len}" ]]; then
            COMPREPLY+=("$pval${eqext-}")
        fi
    done
} &&
    complete -F _comp_cmd_postconf postconf

# ex: filetype=sh