summaryrefslogtreecommitdiff
path: root/priv/shell-completion/bash/rebar3
blob: 758deeeea679074e272e8260cff77545d9cf7f0d (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# bash completion for rebar3

_rebar3()
{
    local cur prev sopts lopts cmdsnvars
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    if [[ ${prev} == rebar3 ]] ; then
        sopts="-h -v"
        lopts="--help --version"
        cmdsnvars="as \
            clean \
            compile \
            cover \
            ct \
            dialyzer \
            do \
            edoc \
            escriptize \
            eunit \
            help \
            new \
            pkgs \
            release \
            shell \
            tar \
            update \
            upgrade \
            version \
            wtf \
            xref"
    elif [[ ${prev} == as ]] ; then
        :
    elif [[ ${prev} == clean ]] ; then
        sopts="-a"
        lopts="--all"
    elif [[ ${prev} == compile ]] ; then
        :
    elif [[ ${prev} == cover ]] ; then
        sopts="-r -v"
        lopts="--reset --verbose"
    elif [[ ${prev} == ct ]] ; then
        sopts="-c -v"
        lopts="--dir \
            --suite \
            --group \
            --case \
            --spec \
            --join_specs \
            --label \
            --config \
            --userconfig \
            --allow_user_terms \
            --logdir \
            --logopts \
            --verbosity \
            --silent_connections \
            --stylesheet \
            --cover \
            --cover_spec \
            --cover_stop \
            --event_handler \
            --include \
            --abort_if_missing_suites \
            --multiply_timetraps \
            --scale_timetraps \
            --create_priv_dir \
            --repeat \
            --duration \
            --until \
            --force_stop \
            --basic_html \
            --ct_hooks \
            --verbose"
    elif [[ ${prev} == dialyzer ]] ; then
        sopts="-u -s"
        lopts="--update-plt --succ-typings"
    elif [[ ${prev} == do ]] ; then
        :
    elif [[ ${prev} == edoc ]] ; then
        :
    elif [[ ${prev} == escriptize ]] ; then
        :
    elif [[ ${prev} == eunit ]] ; then
        sopts="-c -v"
        lopts="--app --cover --suite --verbose"
    elif [[ ${prev} == help ]] ; then
        :
    elif [[ ${prev} == new ]] ; then
        sopts="-f"
        lopts="--force"
    elif [[ ${prev} == pkgs ]] ; then
        :
    elif [[ ${prev} == release ]] ; then
        sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r"
        lopts="--relname \
            --relvsn \
            --goal \
            --upfrom \
            --output-dir \
            --help \
            --lib-dir \
            --path \
            --default-libs \
            --verbose \
            --dev-mode \
            --include-erts \
            --override \
            --config \
            --overlay_vars \
            --vm_args \
            --sys_config \
            --system_libs \
            --version \
            --root"
    elif [[ ${prev} == shell ]] ; then
        :
    elif [[ ${prev} == tar ]] ; then
        sopts="-n -v -g -u -o -h -l -p -V -d -i -a -c -r"
        lopts="--relname \
            --relvsn \
            --goal \
            --upfrom \
            --output-dir \
            --help \
            --lib-dir \
            --path \
            --default-libs \
            --verbose \
            --dev-mode \
            --include-erts \
            --override \
            --config \
            --overlay_vars \
            --vm_args \
            --sys_config \
            --system_libs \
            --version \
            --root"
    elif [[ ${prev} == update ]] ; then
        :
    elif [[ ${prev} == upgrade ]] ; then
        :
    elif [[ ${prev} == version ]] ; then
        :
    elif [[ ${prev} == wtf ]] ; then
        :
    elif [[ ${prev} == xref ]] ; then
        :
    fi

    COMPREPLY=( $(compgen -W "${sopts} ${lopts} ${cmdsnvars}" -- ${cur}) )

    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 _rebar3 rebar3

# 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