Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

287 строки
17 KiB

10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
8 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
10 лет назад
  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. '(--label)--label[Test label]:label' \
  41. '(--config)--config[List of config files]:config files:_files' \
  42. '(--allow_user_terms)--allow_user_terms' \
  43. '(--logdir)--logdir[Log folder]:log folder:_files -/' \
  44. '(--logopts)--logopts' \
  45. '(--verbosity)--verbosity[Verbosity]:verbosity' \
  46. '(-c --cover)'{-c,--cover}'[Generate cover data]' \
  47. '(--repeat)--repeat[How often to repeat tests]:repeat test count' \
  48. '(--duration)--duration[Max runtime (format: HHMMSS)]:max run time' \
  49. '(--until)--until[Run until (format: HHMMSS)]:run until time' \
  50. '(--force_stop)--force_stop[Force stop on test timeout]:skip_rest' \
  51. '(--basic_html)--basic_html[Show basic HTML]' \
  52. '(--stylesheet)--stylesheet[Stylesheet to use for test results]:stylesheet:_files' \
  53. '(--decrypt_key)--decrypt_key[Path to key for decrypting config]:decrypt key:_files' \
  54. '(--decrypt_file)--decrypt_file[Path to file containing key for decrypting config]:decrypt file:_files' \
  55. '(--abort_if_missing_suites)--abort_if_missing_suites[Abort if suites are missing]:abort missing suites:(true false)' \
  56. '(--multiply_timetraps)--multiply_timetraps' \
  57. '(--scale_timetraps)--scale_timetraps' \
  58. '(--create_priv_dir)--create_priv_dir' \
  59. '(--include)--include[Directories containing additional include files]:includes' \
  60. '(-v --verbose)'{-v,--verbose}'[Print coverage analysis]' \
  61. '(--auto_compile)--auto_compile' \
  62. && ret=0
  63. ;;
  64. (deps)
  65. _message 'no more arguments' && ret=0
  66. ;;
  67. (dialyzer)
  68. _arguments \
  69. '(-u --update-plt)'{-u, --update-plt}'[Enable updating the PLT.]' \
  70. '(-s --succ-typings)'{-s, --succ-typings}'[Enable success typing analysis.]' \
  71. && ret=0
  72. ;;
  73. (do)
  74. _message 'rebar do' && ret=0
  75. ;;
  76. (edoc)
  77. _message 'rebar edoc' && ret=0
  78. ;;
  79. (escriptize)
  80. _message 'rebar escriptize' && ret=0
  81. ;;
  82. (eunit)
  83. _arguments \
  84. '(--app)--app[Comma separated list of application test suites to run]:suites' \
  85. '(--application)--application[Comma separated list of application test suites to run]:applications' \
  86. '(-c --cover)'{-c,--cover}'[Generate cover data]' \
  87. '(-d --dir)'{-d,--dir}'[Comma separated list of dirs to load tests from]:dirs' \
  88. '(-e --error_on_warning)'{-e,--error_on_warning}'[Error on invalid test specifications instead of warning]' \
  89. '(-f --file)'{-f,--file}'[Comma separated list of files to load tests from]:files' \
  90. '(-m --module)'{-m,--module}'[Comma separated list of modules to load tests from]:modules' \
  91. '(-s --suite)'{-s,--suite}'[Comma separated list of modules to load tests from]:modules' \
  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. (path)
  106. _arguments \
  107. '(--app)--app[Comma separated list of applications to return paths for.]:apps' \
  108. '(--base)--base[Return the `base` path of the current profile.]' \
  109. '(--bin)--bin[Return the `bin` path of the current profile.]' \
  110. '(--ebin)--ebin[Return all `ebin` paths of the current profile`s applications.]' \
  111. '(--lib)--lib[Return the `lib` path of the current profile.]' \
  112. '(--priv)--priv[Return the `priv` path of the current profile`s applications.]' \
  113. '(-s --separator)--separator[In case of multiple return paths, the separator character to use to join them.]' \
  114. && ret=0
  115. ;;
  116. (pkgs)
  117. _message 'List available packages.' && ret=0
  118. ;;
  119. (plugins)
  120. _arguments \
  121. '1:type:(list upgrade)' \
  122. && ret=0
  123. ;;
  124. (release)
  125. _arguments \
  126. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  127. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  128. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  129. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  130. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  131. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  132. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  133. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  134. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  135. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  136. '(-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]' \
  137. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  138. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  139. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  140. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  141. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  142. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  143. '(--version)--version[Print relx version]' \
  144. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  145. && ret=0
  146. ;;
  147. (relup)
  148. _arguments \
  149. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  150. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  151. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  152. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  153. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  154. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  155. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  156. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  157. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  158. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  159. '(-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]' \
  160. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  161. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  162. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  163. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  164. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  165. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  166. '(--version)--version[Print relx version]' \
  167. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  168. && ret=0
  169. ;;
  170. (report)
  171. _arguments '1: :_rebar3_tasks' && ret=0
  172. ;;
  173. (shell)
  174. _message 'Start a shell with project and deps preloaded' && ret=0
  175. ;;
  176. (tar)
  177. _arguments \
  178. '(-n --relname)'{-n,--relname}'[Specify the name for the release that will be generated.]:relname' \
  179. '(-v --relvsn)'{-n,--relname}'[Specify the version for the release.]:relvsn' \
  180. '(-g --goal)'{-g,--goal}'[Specify a target constraint on the system. These are usually the OTP.]:goal' \
  181. '(-u --upfrom)'{-u,--upfrom}'[Only valid with relup target, specify the release to upgrade from.]:upfrom' \
  182. '(-o --output-dir)'{-o,--output-dir}'[The output directory for the release. This is ./ by default.]:out directory:_files -/' \
  183. '(-l --lib-dir)'{-l,--output-dir}'[Additional dir that should be searched for OTP Apps]:lib directory:_files -/' \
  184. '(-p --path)'{-p,--path}'[Additional dir to add to the code path]:path directory:_files -/' \
  185. '(--default-libs)--default-libs[Whether to use the default system added lib dirs]:default libs:(true false)' \
  186. '(-V --verbose)'{-V,--verbose}'[Verbosity level, maybe between 0 and 3 ,default: 2]:verbosity level:(0 1 2 3)' \
  187. '(-d --dev-mode)'{-d,--dev-mode}'[Symlink the applications and configuration into the release instead of copying]' \
  188. '(-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]' \
  189. '(-a --override)'{-a,--override}'[Provide an app name and a directory to override in the form <appname>:<app directory>]:override' \
  190. '(-c --config)'{-c,--config}'[The path to a config file]:config file:_files ' \
  191. '(--overlay_vars)--overlay_vars[Path to a file of overlay variables]:overlay variables file:_files' \
  192. '(--vm_args)--vm_args[Path to a file to use for vm.args]:vm args file:_files' \
  193. '(--sys_config)--sys_config[Path to a file to use for sys.config]:sys config file:_files' \
  194. '(--system_libs)--system_libs[Path to dir of Erlang system libs]:system libs:_files -/' \
  195. '(--version)--version[Print relx version]' \
  196. '(-r --root)'{-r,--root}'[The project root directory]:system libs:_files -/' \
  197. && ret=0
  198. ;;
  199. (tree)
  200. _arguments \
  201. '(-v --verbose)'{-v,--verbose}'[Print repo and branch/tag/ref for git and hg deps]' \
  202. && ret=0
  203. ;;
  204. (unlock)
  205. _arguments \
  206. '*: :_rebar3_list_deps' \
  207. && ret=0
  208. ;;
  209. (unstable)
  210. _arguments \
  211. '*: :(install upgrade)' \
  212. && ret=0
  213. ;;
  214. (update)
  215. _message 'rebar update' && ret=0
  216. ;;
  217. (upgrade)
  218. _arguments \
  219. '*: :_rebar3_list_deps' \
  220. && ret=0
  221. ;;
  222. (version)
  223. _message 'rebar version' && ret=0
  224. ;;
  225. (xref)
  226. _message 'rebar xref' && ret=0
  227. esac
  228. esac
  229. }
  230. (( $+functions[_rebar3_tasks] )) ||
  231. _rebar3_tasks() {
  232. local tasks; tasks=(
  233. 'as:Higher order provider for running multiple tasks in a sequence as a certain profiles.'
  234. 'clean:Remove compiled beam files from apps.'
  235. 'compile:Compile apps .app.src and .erl files.'
  236. 'cover:Perform coverage analysis.'
  237. 'ct:Run Common Tests.'
  238. 'deps:List dependencies.'
  239. 'dialyzer:Run the Dialyzer analyzer on the project.'
  240. 'do:Higher order provider for running multiple tasks in a sequence.'
  241. 'edoc:Generate documentation using edoc.'
  242. 'escriptize:Generate escript archive.'
  243. 'eunit:Run EUnit Tests.'
  244. 'help:Display a list of tasks or help for a given task or subtask.'
  245. 'new:Create new project from templates.'
  246. 'pkgs:List available packages.'
  247. 'plugins:List or upgrade plugins.'
  248. 'release:Build release of project.'
  249. 'relup:Create relup from 2 releases.'
  250. 'report:Provide a crash report to be sent to the rebar3 issues page.'
  251. 'shell:Run shell with project apps and deps in path.'
  252. 'tar:Tar archive of release built of project.'
  253. 'tree:Print dependency tree.'
  254. 'unlock:Unlock dependencies.'
  255. 'unstable:Namespace providing commands that are still in flux.'
  256. 'update:Update package index.'
  257. 'upgrade:Upgrade dependencies.'
  258. 'version:Print version for rebar and current Erlang.'
  259. 'xref:Run cross reference analysis.'
  260. )
  261. _describe -t tasks 'rebar3 tasks' tasks "$@"
  262. }
  263. (( $+functions[_rebar3_list_deps] )) ||
  264. _rebar3_list_deps() {
  265. local -a cmd packages deps_long
  266. deps_long=($PWD/_build/default/lib/*(/))
  267. packages=( ${${deps_long#$PWD/_build/default/lib/}%-*-*} )
  268. compadd "$@" -a packages
  269. }
  270. _rebar3 "$@"
  271. # Local variables:
  272. # mode: shell-script
  273. # sh-basic-offset: 2
  274. # sh-indent-comment: t
  275. # indent-tabs-mode: nil
  276. # End:
  277. # ex: sw=2 ts=2 et filetype=sh