summaryrefslogtreecommitdiff
path: root/priv/shell-completion/bash/rebar
blob: 375566cbcff33347ac5c733257e8d36ff6ab7ecb (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# bash completion for rebar

_rebar()
{
    local cur prev sopts lopts cmdsnvars
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    sopts="-h -c -v -V -f -D -j -C -p -k -r"
    lopts="--help \
        --commands \
        --verbose \
        --force \
        --jobs \
        --config \
        --profile \
        --keep-going \
        --recursive \
        --version"
    cmdsnvars="check-deps \
        clean \
        compile \
        create \
        create-app \
        create-lib \
        create-node \
        ct \
        doc \
        delete-deps \
        escriptize \
        eunit \
        get-deps \
        generate \
        generate-appups \
        generate-upgrade \
        help \
        list-deps \
        list-templates \
        prepare-deps \
        qc \
        refresh-deps \
        update-deps \
        version \
        xref \
        overlay \
        apps= \
        case= \
        dump_spec=1 \
        force=1 \
        jobs= \
        suites= \
        verbose=1 \
        appid= \
        overlay_vars= \
        previous_release= \
        nodeid= \
        root_dir= \
        skip_deps=true \
        skip_apps= \
        target_dir= \
        template= \
        template_dir= \
        tests="

    if [[ ${cur} == --* ]] ; then
        COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
    elif [[ ${cur} == -* ]] ; then
        COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
    else
        COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
    fi

    if [ -n "$COMPREPLY" ] ; then
        # append space if matched
        COMPREPLY="${COMPREPLY} "
        # remove trailing space after equal sign
        COMPREPLY=${COMPREPLY/%= /=}
    fi
    return 0
}
complete -o nospace -F _rebar rebar

# 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