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

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

    case $prev in
        -c)
            _comp_compgen_filedir -d
            return
            ;;
        -[dr])
            _comp_compgen_split -- "ALL $(mailq 2>/dev/null |
                command sed -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//')"
            return
            ;;
        -h)
            _comp_compgen_split -- "ALL $(mailq 2>/dev/null |
                command sed \
                    -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d')"
            return
            ;;
        -H)
            _comp_compgen_split -- "ALL $(mailq 2>/dev/null | command sed \
                -e '1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//')"
            return
            ;;
    esac

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

    _comp_compgen -- -W 'hold incoming active deferred'
} &&
    complete -F _comp_cmd_postsuper postsuper

# ex: filetype=sh