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.

_bundle 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #compdef bundle
  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 Bundler (http://gembundler.com).
  32. #
  33. # ------------------------------------------------------------------------------
  34. # Authors
  35. # -------
  36. #
  37. # * Bruno Michel (https://github.com/nono)
  38. #
  39. # ------------------------------------------------------------------------------
  40. local curcontext="$curcontext" state line _gems _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 "bundle command" \
  48. "install[Install the gems specified by the Gemfile or Gemfile.lock]" \
  49. "update[Update dependencies to their latest versions]" \
  50. "package[Package the .gem files required by your application]" \
  51. "exec[Execute a script in the context of the current bundle]" \
  52. "config[Specify and read configuration options for bundler]" \
  53. "check[Determine whether the requirements for your application are installed]" \
  54. "list[Show all of the gems in the current bundle]" \
  55. "show[Show the source location of a particular gem in the bundle]" \
  56. "console[Start an IRB session in the context of the current bundle]" \
  57. "open[Open an installed gem in the editor]" \
  58. "viz[Generate a visual representation of your dependencies]" \
  59. "init[Generate a simple Gemfile, placed in the current directory]" \
  60. "gem[Create a simple gem, suitable for development with bundler]" \
  61. "help[Describe available tasks or one specific task]" \
  62. "platform[Displays platform compatibility information]" \
  63. "outdated[Show all of the outdated gems in the current bundle]"
  64. ret=0
  65. ;;
  66. args)
  67. case $line[1] in
  68. help)
  69. _values 'commands' 'install' 'update' 'package' 'exec' 'config' 'check' 'list' 'show' 'console' 'open' 'viz' 'init' 'gem' 'help' 'platform' 'outdated' && ret=0
  70. ;;
  71. install)
  72. _policies=('HighSecurity' 'MediumSecurity' 'LowSecurity' 'AlmostNoSecurity' 'NoSecurity')
  73. _arguments \
  74. '(--no-color)--no-color[disable colorization in output]' \
  75. '(--local)--local[do not attempt to connect to rubygems.org]' \
  76. '(--quiet)--quiet[only output warnings and errors]' \
  77. '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
  78. '(--system)--system[install to the system location]' \
  79. '(--deployment)--deployment[install using defaults tuned for deployment environments]' \
  80. '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
  81. '(--path)--path=-[specify a different path than the system default]:path:_files' \
  82. '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
  83. '(--without)--without=-[exclude gems that are part of the specified named group]:groups' \
  84. '(--with)--with=-[include gems that are part of the specified named group]:groups' \
  85. '(--clean)--clean[remove any gems not present in the current Gemfile]' \
  86. '(--full-index)--full-index[download and cache the index file of all gems]' \
  87. '(--jobs)--jobs=-[install gems parallely]:number' \
  88. '(--force)--force[force download every gem]' \
  89. '(--no-cache)--no-cache[do not update the cache in vendor/cache with newly installed gems]' \
  90. '(--no-prune)--no-prune[do not remove stale gem from cache after installation]' \
  91. '(--retry)--retry=-[number of times to retry failed network or git requests]:number' \
  92. '(--sheband)--shebang=-[specify ruby executable to execute scripts]:ruby' \
  93. '(--standalone)--standalone=-[create standalone bundles]:groups' \
  94. "(--trust-policy)--trust-policy=-[apply the Rubygems security policy]:arg:($_policies)"
  95. ret=0
  96. ;;
  97. exec)
  98. _normal && ret=0
  99. ;;
  100. (open|show)
  101. _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
  102. if [[ $_gems != "" ]]; then
  103. _values 'gems' $_gems && ret=0
  104. fi
  105. ;;
  106. *)
  107. _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
  108. _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
  109. if [[ $_opts != "" ]]; then
  110. _values 'options' $_opts && ret=0
  111. fi
  112. ;;
  113. esac
  114. ;;
  115. esac
  116. return ret
  117. # Local Variables:
  118. # mode: Shell-Script
  119. # sh-indentation: 2
  120. # indent-tabs-mode: nil
  121. # sh-basic-offset: 2
  122. # End:
  123. # vim: ft=zsh sw=2 ts=2 et