Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

270 rindas
16 KiB

  1. #compdef rebar3
  2. _rebar3 () {
  3. typeset -A opt_args
  4. local curcontext="$curcontext" state line
  5. local ret=1
  6. _arguments -C \
  7. '1: :_rebar3_tasks' \
  8. '*::arg:->args' \
  9. && ret=0
  10. case $state in
  11. (args)
  12. curcontext="${curcontext%:*:*}:rebar-task-$words[1]:"
  13. case $line[1] in
  14. (as)
  15. _arguments \
  16. '1:name' \
  17. '2: :_rebar3_tasks' \
  18. && ret=0
  19. ;;
  20. (clean)
  21. _arguments \
  22. '(-a --all)'{-a,--all}'[Clean all apps include deps.]' \
  23. && ret=0
  24. ;;
  25. (compile)
  26. _message 'no more arguments' && ret=0
  27. ;;
  28. (cover)
  29. _arguments \
  30. '(-r --reset)'{-r,--reset}'[Reset all coverdata.]' \
  31. '(-v --verbose)'{-v,--verbose}'[Print coverage analysis.]' \
  32. && ret=0
  33. ;;
  34. (ct)
  35. _arguments \
  36. '(--dir)--dir[List of additional directories containing test suites]:test directory:_files -/' \
  37. '(--suite)--suite[List of test suites to run]:suites' \
  38. '(--group)--group[List of test groups to run]:groups' \
  39. '(--case)--case[List of test cases to run]:cases' \
  40. '(--spec)--spec[List of test specs to run]:specs' \
  41. '(--join_specs)--join_specs' \
  42. '(--label)--label[Test label]:label' \
  43. '(--config)--config[List of config files]:config files:_files' \
  44. '(--userconfig)--userconfig' \
  45. '(--allow_user_terms)--allow_user_terms' \
  46. '(--logdir)--logdir[Log folder]:log folder:_files -/' \
  47. '(--logopts)--logopts' \
  48. '(--verbosity)--verbosity[Verbosity]:verbosity' \
  49. '(--silent_connections)--silent_connections' \
  50. '(--stylesheet)--stylesheet[Stylesheet to use for test results]:stylesheet:_files' \
  51. '(-c --cover)'{-c,--cover}'[Generate cover data]' \
  52. '(--cover_spec)--cover_spec[Cover file to use]:cover file:_files' \
  53. '(--cover_stop)--cover_stop' \
  54. '(--event_handler)--event_handler[Event handlers to attach to the runner]:event handlers' \
  55. '(--include)--include[Include folder]:include directory:_files -/' \
  56. '(--abort_if_missing_suites)--abort_if_missing_suites[Abort if suites are missing]:abort missing suites:(true false)' \
  57. '(--multiply_timetraps)--multiply_timetraps' \
  58. '(--scale_timetraps)--scale_timetraps' \
  59. '(--create_priv_dir)--create_priv_dir' \
  60. '(--repeat)--repeat[How often to repeat tests]:repeat test count' \
  61. '(--duration)--duration[Max runtime (format: HHMMSS)]:max run time' \
  62. '(--until)--until[Run until (format: HHMMSS)]:run until time' \
  63. '(--force_stop)--force_stop[Force stop after time]' \
  64. '(--basic_html)--basic_html[Show basic HTML]' \
  65. '(--ct_hooks)--ct_hooks:ct hooks' \
  66. '(-v --verbose)'{-v,--verbose}'[Print coverage analysis]' \
  67. && ret=0
  68. ;;
  69. (deps)
  70. _message 'no more arguments' && ret=0
  71. ;;
  72. (dialyzer)
  73. _arguments \
  74. '(-u --update-plt)'{-u, --update-plt}'[Enable updating the PLT.]' \
  75. '(-s --succ-typings)'{-s, --succ-typings}'[Enable success typing analysis.]' \
  76. && ret=0
  77. ;;
  78. (do)
  79. _message 'rebar do' && ret=0
  80. ;;
  81. (edoc)
  82. _message 'rebar edoc' && ret=0
  83. ;;
  84. (escriptize)
  85. _message 'rebar escriptize' && ret=0
  86. ;;
  87. (eunit)
  88. _arguments \
  89. '(--app)--app[List of application test suites to run]:suites' \
  90. '(--suite)--suite[List of test suites to run]:suites' \
  91. '(-c --cover)'{-c,--cover}'[Generate cover data]' \
  92. '(-v --verbose)'{-v,--verbose}'[Verbose output]' \
  93. && ret=0
  94. ;;
  95. (help)
  96. _arguments '1: :_rebar3_tasks' && ret=0
  97. ;;
  98. (new)
  99. _arguments \
  100. '1:type:(app cmake escript lib plugin release)' \
  101. '2:name:' \
  102. '(-f --force)'{-f,--force}'[ overwrite existing files]' \
  103. && ret=0
  104. ;;
  105. (pkgs)
  106. _message 'List available packages.' && ret=0
  107. ;;
  108. (plugins)
  109. _arguments \
  110. '1:type:(list upgrade)' \
  111. && ret=0
  112. ;;
  113. (release)
  114. _arguments \
  115. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  116. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  117. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  118. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  119. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  120. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  121. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  122. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  123. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  124. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  125. '(-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]' \
  126. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  127. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  128. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  129. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  130. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  131. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  132. '(--version)--version[Print relx version]' \
  133. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  134. && ret=0
  135. ;;
  136. (relup)
  137. _arguments \
  138. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  139. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  140. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  141. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  142. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  143. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  144. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  145. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  146. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  147. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  148. '(-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]' \
  149. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  150. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  151. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  152. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  153. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  154. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  155. '(--version)--version[Print relx version]' \
  156. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  157. && ret=0
  158. ;;
  159. (report)
  160. _arguments '1: :_rebar3_tasks' && ret=0
  161. ;;
  162. (shell)
  163. _message 'Start a shell with project and deps preloaded' && ret=0
  164. ;;
  165. (tar)
  166. _arguments \
  167. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  168. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  169. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  170. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  171. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  172. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  173. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  174. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  175. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  176. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  177. '(-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]' \
  178. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  179. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  180. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  181. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  182. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  183. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  184. '(--version)--version[Print relx version]' \
  185. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  186. && ret=0
  187. ;;
  188. (tree)
  189. _arguments \
  190. '(-v --verbose)'{-v,--verbose}'[Print repo and branch/tag/ref for git and hg deps]' \
  191. && ret=0
  192. ;;
  193. (unlock)
  194. _arguments \
  195. '*: :_rebar3_list_deps' \
  196. && ret=0
  197. ;;
  198. (update)
  199. _message 'rebar update' && ret=0
  200. ;;
  201. (upgrade)
  202. _arguments \
  203. '*: :_rebar3_list_deps' \
  204. && ret=0
  205. ;;
  206. (version)
  207. _message 'rebar version' && ret=0
  208. ;;
  209. (xref)
  210. _message 'rebar xref' && ret=0
  211. esac
  212. esac
  213. }
  214. (( $+functions[_rebar3_tasks] )) ||
  215. _rebar3_tasks() {
  216. local tasks; tasks=(
  217. 'as:Higher order provider for running multiple tasks in a sequence as a certain profiles.'
  218. 'clean:Remove compiled beam files from apps.'
  219. 'compile:Compile apps .app.src and .erl files.'
  220. 'cover:Perform coverage analysis.'
  221. 'ct:Run Common Tests.'
  222. 'deps:List dependencies.'
  223. 'dialyzer:Run the Dialyzer analyzer on the project.'
  224. 'do:Higher order provider for running multiple tasks in a sequence.'
  225. 'edoc:Generate documentation using edoc.'
  226. 'escriptize:Generate escript archive.'
  227. 'eunit:Run EUnit Tests.'
  228. 'help:Display a list of tasks or help for a given task or subtask.'
  229. 'new:Create new project from templates.'
  230. 'pkgs:List available packages.'
  231. 'plugins:List or upgrade plugins.'
  232. 'release:Build release of project.'
  233. 'relup:Create relup from 2 releases.'
  234. 'report:Provide a crash report to be sent to the rebar3 issues page.'
  235. 'shell:Run shell with project apps and deps in path.'
  236. 'tar:Tar archive of release built of project.'
  237. 'tree:Print dependency tree.'
  238. 'unlock:Unlock dependencies.'
  239. 'update:Update package index.'
  240. 'upgrade:Upgrade dependencies.'
  241. 'version:Print version for rebar and current Erlang.'
  242. 'xref:Run cross reference analysis.'
  243. )
  244. _describe -t tasks 'rebar3 tasks' tasks "$@"
  245. }
  246. (( $+functions[_rebar3_list_deps] )) ||
  247. _rebar3_list_deps() {
  248. local -a cmd packages deps_long
  249. deps_long=($PWD/_build/default/lib/*(/))
  250. packages=( ${${deps_long#$PWD/_build/default/lib/}%-*-*} )
  251. compadd "$@" -a packages
  252. }
  253. _rebar3 "$@"
  254. # Local variables:
  255. # mode: shell-script
  256. # sh-basic-offset: 2
  257. # sh-indent-comment: t
  258. # indent-tabs-mode: nil
  259. # End:
  260. # ex: sw=2 ts=2 et filetype=sh