Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

224 righe
12 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. (dialyzer)
  70. _arguments \
  71. '(-u --update-plt)'{-u, --update-plt}'[Enable updating the PLT.]' \
  72. '(-s --succ-typings)'{-s, --succ-typings}'[Enable success typing analysis.]' \
  73. && ret=0
  74. ;;
  75. (do)
  76. _message 'rebar do' && ret=0
  77. ;;
  78. (edoc)
  79. _message 'rebar edoc' && ret=0
  80. ;;
  81. (escriptize)
  82. _message 'rebar escriptize' && ret=0
  83. ;;
  84. (eunit)
  85. _arguments \
  86. '(--app)--app[List of application test suites to run]:suites' \
  87. '(--suite)--suite[List of test suites to run]:suites' \
  88. '(-c --cover)'{-c,--cover}'[Generate cover data]' \
  89. '(-v --verbose)'{-v,--verbose}'[Verbose output]' \
  90. && ret=0
  91. ;;
  92. (help)
  93. _arguments '1: :_rebar3_tasks' && ret=0
  94. ;;
  95. (new)
  96. _arguments \
  97. '1:type:(app lib release plugin)' \
  98. '2:name:' \
  99. '(-f --force)'{-f,--force}'[ overwrite existing files]' \
  100. && ret=0
  101. ;;
  102. (pkgs)
  103. _message 'List available packages.' && ret=0
  104. ;;
  105. (release)
  106. _arguments \
  107. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  108. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  109. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  110. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  111. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  112. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  113. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  114. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  115. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  116. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  117. '(-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]' \
  118. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  119. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  120. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  121. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  122. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  123. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  124. '(--version)--version[Print relx version]' \
  125. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  126. && ret=0
  127. ;;
  128. (report)
  129. _arguments '1: :_rebar3_tasks' && ret=0
  130. ;;
  131. (shell)
  132. _message 'Start a shell with project and deps preloaded' && ret=0
  133. ;;
  134. (tar)
  135. _arguments \
  136. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  137. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  138. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  139. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  140. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  141. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  142. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  143. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  144. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  145. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  146. '(-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]' \
  147. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  148. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  149. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  150. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  151. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  152. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  153. '(--version)--version[Print relx version]' \
  154. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  155. && ret=0
  156. ;;
  157. (update)
  158. _message 'rebar update' && ret=0
  159. ;;
  160. (upgrade)
  161. _arguments \
  162. '*: :_rebar3_list_deps' \
  163. && ret=0
  164. ;;
  165. (version)
  166. _message 'rebar version' && ret=0
  167. ;;
  168. (xref)
  169. _message 'rebar xref' && ret=0
  170. esac
  171. esac
  172. }
  173. (( $+functions[_rebar3_tasks] )) ||
  174. _rebar3_tasks() {
  175. local tasks; tasks=(
  176. 'as:Higher order provider for running multiple tasks in a sequence as a certain profiles.'
  177. 'clean:Remove compiled beam files from apps.'
  178. 'compile:Compile apps .app.src and .erl files.'
  179. 'cover:Perform coverage analysis.'
  180. 'ct:Run Common Tests.'
  181. 'dialyzer:Run the Dialyzer analyzer on the project.'
  182. 'do:Higher order provider for running multiple tasks in a sequence.'
  183. 'edoc:Generate documentation using edoc.'
  184. 'escriptize:Generate escript archive.'
  185. 'eunit:Run EUnit Tests.'
  186. 'help:Display a list of tasks or help for a given task or subtask.'
  187. 'new:Create new project from templates.'
  188. 'pkgs:List available packages.'
  189. 'release:Build release of project.'
  190. 'report:Provide a crash report to be sent to the rebar3 issues page.'
  191. 'shell:Run shell with project apps and deps in path.'
  192. 'tar:Tar archive of release built of project.'
  193. 'update:Update package index.'
  194. 'upgrade:Upgrade dependencies.'
  195. 'version:Print version for rebar and current Erlang.'
  196. 'xref:Run cross reference analysis.'
  197. )
  198. _describe -t tasks 'rebar3 tasks' tasks "$@"
  199. }
  200. (( $+functions[_rebar3_list_deps] )) ||
  201. _rebar3_list_deps() {
  202. local -a cmd packages deps_long
  203. deps_long=($PWD/_build/default/lib/*(/))
  204. packages=( ${${deps_long#$PWD/_build/default/lib/}%-*-*} )
  205. compadd "$@" -a packages
  206. }
  207. _rebar3 "$@"
  208. # Local variables:
  209. # mode: shell-script
  210. # sh-basic-offset: 2
  211. # sh-indent-comment: t
  212. # indent-tabs-mode: nil
  213. # End:
  214. # ex: sw=2 ts=2 et filetype=sh