summaryrefslogtreecommitdiffstats
path: root/completions/pine
blob: 6844db005f5ccd11d8ccaac293623fca34116491 (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
# pine/alpine completion                                   -*- shell-script -*-

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

    case $prev in
        -help | -d | -f | -c | -I | -n | -url | -copy_pinerc | -copy_abook)
            return
            ;;
        -attach | -attachlist | -attach_and_delete | -p | -P | -pinerc | \
            -passfile | -x)
            _comp_compgen_filedir
            return
            ;;
        -sort)
            _comp_compgen -- -W 'arrival subject threaded orderedsubject date
                from size score to cc'
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        _comp_compgen_help -- -h
    else
        _comp_compgen_split -- "$(_comp_awk '{print $1}' ~/.addressbook 2>/dev/null)"
    fi
} &&
    complete -F _comp_cmd_pine pine alpine

# ex: filetype=sh