My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_bower 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #compdef bower
  2. # ------------------------------------------------------------------------------
  3. # Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. # * Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # * Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in the
  12. # documentation and/or other materials provided with the distribution.
  13. # * Neither the name of the zsh-users nor the
  14. # names of its contributors may be used to endorse or promote products
  15. # derived from this software without specific prior written permission.
  16. #
  17. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. # ------------------------------------------------------------------------------
  28. # Description
  29. # -----------
  30. #
  31. # Completion script for Bower (http://bower.io).
  32. #
  33. # ------------------------------------------------------------------------------
  34. # Authors
  35. # -------
  36. #
  37. # * Joe Lencioni (https://github.com/lencioni)
  38. #
  39. # ------------------------------------------------------------------------------
  40. local curcontext="$curcontext" state line _packages _opts ret=1
  41. _arguments -C -A "-v" -A "--version" \
  42. '(- 1 *)'{-v,--version}'[display version information]' \
  43. '1: :->cmds' \
  44. '*:: :->args' && ret=0
  45. case $state in
  46. cmds)
  47. _values "bower command" \
  48. "cache[Manage bower cache]" \
  49. "help[Display help information about Bower]" \
  50. "home[Opens a package homepage into your favorite browser]" \
  51. "info[Info of a particular package]" \
  52. "init[Interactively create a bower.json file]" \
  53. "install[Install a package locally]" \
  54. "link[Symlink a package folder]" \
  55. "list[List local packages - and possible updates]" \
  56. "login[Authenticate with GitHub and store credentials]" \
  57. "lookup[Look up a package URL by name]" \
  58. "prune[Removes local extraneous packages]" \
  59. "register[Register a package]" \
  60. "search[Search for a package by name]" \
  61. "update[Update a local package]" \
  62. "uninstall[Remove a local package]" \
  63. "unregister[Remove a package from the registry]" \
  64. "version[Bump a package version]"
  65. _arguments \
  66. '(--force)--force[Makes various commands more forceful]' \
  67. '(--json)--json[Output consumable JSON]' \
  68. '(--log-level)--log-level[What level of logs to report]' \
  69. '(--offline)--offline[Do not hit the network]' \
  70. '(--quiet)--quiet[Only output important information]' \
  71. '(--silent)--silent[Do not output anything, besides errors]' \
  72. '(--verbose)--verbose[Makes output more verbose]' \
  73. '(--allow-root)--allow-root[Allows running commands as root]' \
  74. '(--version)--version[Output Bower version]' \
  75. '(--no-color)--no-color[Disable colors]'
  76. ret=0
  77. ;;
  78. args)
  79. case $line[1] in
  80. help)
  81. _values 'commands' \
  82. 'cache' \
  83. 'home' \
  84. 'info' \
  85. 'init' \
  86. 'install' \
  87. 'link' \
  88. 'list' \
  89. 'login' \
  90. 'lookup' \
  91. 'prune' \
  92. 'register' \
  93. 'search' \
  94. 'update' \
  95. 'uninstall' \
  96. 'unregister' \
  97. 'version'
  98. ret=0
  99. ;;
  100. (home|info|init|link|lookup|prune|register|search|unregister)
  101. _arguments \
  102. '(--help)--help[Show help message]'
  103. ret=0
  104. ;;
  105. install)
  106. _arguments \
  107. '(--force-latest)--force-latest[Force latest version on conflict]' \
  108. '(--help)--help[Show help message]' \
  109. '(--production)--production[Do not install project devDependencies]' \
  110. '(--save)--save[Save installed packages into the project''s bower.json dependencies]' \
  111. '(--save-dev)--save-dev[Save installed packages into the project''s bower.json devDependencies]'
  112. ret=0
  113. ;;
  114. list)
  115. _arguments \
  116. '(--help)--help[Show help message]' \
  117. '(--paths)--paths[Generate a simple JSON source mapping]' \
  118. '(--relative)--relative[Make paths relative to the directory config property, which defaults to bower_components]'
  119. ret=0
  120. ;;
  121. login)
  122. _arguments \
  123. '(--help)--help[Show help message]' \
  124. '(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]'
  125. ret=0
  126. ;;
  127. uninstall)
  128. _arguments \
  129. '(--help)--help[Show help message]' \
  130. '(--save)--save[Save installed packages into th projects''s bower.json dependencies]' \
  131. '(--save-dev)--save-dev[Save installed packages into th projects''s bower.json devDependencies]'
  132. ret=0
  133. ;;
  134. update)
  135. _arguments \
  136. '(--force-latest)--force-latest[Force latest version on conflict]' \
  137. '(--help)--help[Show help message]' \
  138. '(--production)--production[Do not install project devDependencies]'
  139. ret=0
  140. ;;
  141. version)
  142. _arguments \
  143. '(--message)--message[Custom git commit and tag message]'
  144. ret=0
  145. ;;
  146. exec)
  147. _normal && ret=0
  148. ;;
  149. *)
  150. _opts=( $(bower help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
  151. _opts+=( $(bower help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
  152. if [[ $_opts != "" ]]; then
  153. _values 'options' $_opts && ret=0
  154. fi
  155. ;;
  156. esac
  157. ;;
  158. esac
  159. return ret
  160. # Local Variables:
  161. # mode: Shell-Script
  162. # sh-indentation: 2
  163. # indent-tabs-mode: nil
  164. # sh-basic-offset: 2
  165. # End:
  166. # vim: ft=zsh sw=2 ts=2 et