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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
#compdef rebar3
_rebar3 () {
typeset -A opt_args
local curcontext="$curcontext" state line
local ret=1
_arguments -C \
'1: :_rebar3_tasks' \
'*::arg:->args' \
&& ret=0
case $state in
(args)
curcontext="${curcontext%:*:*}:rebar-task-$words[1]:"
case $line[1] in
(as)
_arguments \
'1:name' \
'2: :_rebar3_tasks' \
&& ret=0
;;
(clean)
_arguments \
'(-a --all)'{-a,--all}'[Clean all apps include deps.]' \
&& ret=0
;;
(compile)
_message 'no more arguments' && ret=0
;;
(cover)
_arguments \
'(-r --reset)'{-r,--reset}'[Reset all coverdata.]' \
'(-v --verbose)'{-v,--verbose}'[Print coverage analysis.]' \
&& ret=0
;;
(ct)
_arguments \
'(--dir)--dir[List of additional directories containing test suites]:test directory:_files -/' \
'(--suite)--suite[List of test suites to run]:suites' \
'(--group)--group[List of test groups to run]:groups' \
'(--case)--case[List of test cases to run]:cases' \
'(--label)--label[Test label]:label' \
'(--config)--config[List of config files]:config files:_files' \
'(--allow_user_terms)--allow_user_terms' \
'(--logdir)--logdir[Log folder]:log folder:_files -/' \
'(--logopts)--logopts' \
'(--verbosity)--verbosity[Verbosity]:verbosity' \
'(-c --cover)'{-c,--cover}'[Generate cover data]' \
'(--repeat)--repeat[How often to repeat tests]:repeat test count' \
'(--duration)--duration[Max runtime (format: HHMMSS)]:max run time' \
'(--until)--until[Run until (format: HHMMSS)]:run until time' \
'(--force_stop)--force_stop[Force stop on test timeout]:skip_rest' \
'(--basic_html)--basic_html[Show basic HTML]' \
'(--stylesheet)--stylesheet[Stylesheet to use for test results]:stylesheet:_files' \
'(--decrypt_key)--decrypt_key[Path to key for decrypting config]:decrypt key:_files' \
'(--decrypt_file)--decrypt_file[Path to file containing key for decrypting config]:decrypt file:_files' \
'(--abort_if_missing_suites)--abort_if_missing_suites[Abort if suites are missing]:abort missing suites:(true false)' \
'(--multiply_timetraps)--multiply_timetraps' \
'(--scale_timetraps)--scale_timetraps' \
'(--create_priv_dir)--create_priv_dir' \
'(-v --verbose)'{-v,--verbose}'[Print coverage analysis]' \
'(--auto_compile)--auto_compile' \
&& ret=0
;;
(deps)
_message 'no more arguments' && ret=0
;;
(dialyzer)
_arguments \
'(-u --update-plt)'{-u, --update-plt}'[Enable updating the PLT.]' \
'(-s --succ-typings)'{-s, --succ-typings}'[Enable success typing analysis.]' \
&& ret=0
;;
(do)
_message 'rebar do' && ret=0
;;
(edoc)
_message 'rebar edoc' && ret=0
;;
(escriptize)
_message 'rebar escriptize' && ret=0
;;
(eunit)
_arguments \
'(--app)--app[Comma separated list of application test suites to run]:suites' \
'(--application)--application[Comma separated list of application test suites to run]:applications' \
'(-c --cover)'{-c,--cover}'[Generate cover data]' \
'(-d --dir)'{-d,--dir}'[Comma separated list of dirs to load tests from]:dirs' \
'(-e --error_on_warning)'{-e,--error_on_warning}'[Error on invalid test specifications instead of warning]' \
'(-f --file)'{-f,--file}'[Comma separated list of files to load tests from]:files' \
'(-m --module)'{-m,--module}'[Comma separated list of modules to load tests from]:modules' \
'(-s --suite)'{-s,--suite}'[Comma separated list of modules to load tests from]:modules' \
'(-v --verbose)'{-v,--verbose}'[Verbose output]' \
&& ret=0
;;
(help)
_arguments '1: :_rebar3_tasks' && ret=0
;;
(new)
_arguments \
'1:type:(app cmake escript lib plugin release)' \
'2:name:' \
'(-f --force)'{-f,--force}'[ overwrite existing files]' \
&& ret=0
;;
(path)
_arguments \
'(--app)--app[Comma seperated list of applications to return paths for.]:apps' \
'(--base)--base[Return the `base` path of the current profile.]' \
'(--bin)--bin[Return the `bin` path of the current profile.]' \
'(--ebin)--ebin[Return all `ebin` paths of the current profile`s applications.]' \
'(--lib)--lib[Return the `lib` path of the current profile.]' \
'(--priv)--priv[Return the `priv` path of the current profile`s applications.]' \
'(-s --separator)--separator[In case of multiple return paths, the separator character to use to join them.]' \
&& ret=0
;;
(pkgs)
_message 'List available packages.' && ret=0
;;
(plugins)
_arguments \
'1:type:(list upgrade)' \
&& ret=0
;;
(release)
_arguments \
'(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
'(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
'(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
'(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
'(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
'(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
'(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
'(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
'(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
'(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
'(-i --include-erts)'{-i,--dev-mode}'[If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts]' \
'(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
'(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
'(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
'(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
'(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
'(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
'(--version)--version[Print relx version]' \
'(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
&& ret=0
;;
(relup)
_arguments \
'(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
'(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
'(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
'(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
'(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
'(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
'(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
'(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
'(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
'(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
'(-i --include-erts)'{-i,--dev-mode}'[If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts]' \
'(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
'(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
'(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
'(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
'(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
'(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
'(--version)--version[Print relx version]' \
'(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
&& ret=0
;;
(report)
_arguments '1: :_rebar3_tasks' && ret=0
;;
(shell)
_message 'Start a shell with project and deps preloaded' && ret=0
;;
(tar)
_arguments \
'(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
'(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
'(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
'(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
'(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
'(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
'(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
'(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
'(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
'(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
'(-i --include-erts)'{-i,--dev-mode}'[If true include a copy of erts used to build with, if a path include erts at that path. If false, do not include erts]' \
'(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
'(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
'(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
'(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
'(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
'(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
'(--version)--version[Print relx version]' \
'(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
&& ret=0
;;
(tree)
_arguments \
'(-v --verbose)'{-v,--verbose}'[Print repo and branch/tag/ref for git and hg deps]' \
&& ret=0
;;
(unlock)
_arguments \
'*: :_rebar3_list_deps' \
&& ret=0
;;
(unstable)
_arguments \
'*: :(install upgrade)' \
&& ret=0
;;
(update)
_message 'rebar update' && ret=0
;;
(upgrade)
_arguments \
'*: :_rebar3_list_deps' \
&& ret=0
;;
(version)
_message 'rebar version' && ret=0
;;
(xref)
_message 'rebar xref' && ret=0
esac
esac
}
(( $+functions[_rebar3_tasks] )) ||
_rebar3_tasks() {
local tasks; tasks=(
'as:Higher order provider for running multiple tasks in a sequence as a certain profiles.'
'clean:Remove compiled beam files from apps.'
'compile:Compile apps .app.src and .erl files.'
'cover:Perform coverage analysis.'
'ct:Run Common Tests.'
'deps:List dependencies.'
'dialyzer:Run the Dialyzer analyzer on the project.'
'do:Higher order provider for running multiple tasks in a sequence.'
'edoc:Generate documentation using edoc.'
'escriptize:Generate escript archive.'
'eunit:Run EUnit Tests.'
'help:Display a list of tasks or help for a given task or subtask.'
'new:Create new project from templates.'
'pkgs:List available packages.'
'plugins:List or upgrade plugins.'
'release:Build release of project.'
'relup:Create relup from 2 releases.'
'report:Provide a crash report to be sent to the rebar3 issues page.'
'shell:Run shell with project apps and deps in path.'
'tar:Tar archive of release built of project.'
'tree:Print dependency tree.'
'unlock:Unlock dependencies.'
'unstable:Namespace providing commands that are still in flux.'
'update:Update package index.'
'upgrade:Upgrade dependencies.'
'version:Print version for rebar and current Erlang.'
'xref:Run cross reference analysis.'
)
_describe -t tasks 'rebar3 tasks' tasks "$@"
}
(( $+functions[_rebar3_list_deps] )) ||
_rebar3_list_deps() {
local -a cmd packages deps_long
deps_long=($PWD/_build/default/lib/*(/))
packages=( ${${deps_long#$PWD/_build/default/lib/}%-*-*} )
compadd "$@" -a packages
}
_rebar3 "$@"
# Local variables:
# mode: shell-script
# sh-basic-offset: 2
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: sw=2 ts=2 et filetype=sh
|