summaryrefslogtreecommitdiff
path: root/completions/cal
blob: f6fafb5963c7259cc1c05f1ed7e8077a1ad27544 (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
_cal()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -m)
            if [[ $OSTYPE == *bsd* ]]; then
                COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
                return
            fi
            ;;
        -s)
            [[ $OSTYPE == *bsd* ]] && return
            ;;
        -A|-B|-d|-H)
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
        return
    fi

    local args
    _count_args
    [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
} &&
complete -F _cal cal ncal

# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh