_bundler 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #compdef bundle
  2. local curcontext="$curcontext" state line _gems _opts ret=1
  3. _arguments -C -A "-v" -A "--version" \
  4. '(- 1 *)'{-v,--version}'[display version information]' \
  5. '1: :->cmds' \
  6. '*:: :->args' && ret=0
  7. case $state in
  8. cmds)
  9. _values "bundle command" \
  10. "install[Install the gems specified by the Gemfile or Gemfile.lock]" \
  11. "update[Update dependencies to their latest versions]" \
  12. "package[Package the .gem files required by your application]" \
  13. "exec[Execute a script in the context of the current bundle]" \
  14. "config[Specify and read configuration options for bundler]" \
  15. "check[Determine whether the requirements for your application are installed]" \
  16. "list[Show all of the gems in the current bundle]" \
  17. "show[Show the source location of a particular gem in the bundle]" \
  18. "info[Show details of a particular gem in the bundle]" \
  19. "outdated[Show all of the outdated gems in the current bundle]" \
  20. "console[Start an IRB session in the context of the current bundle]" \
  21. "open[Open an installed gem in the editor]" \
  22. "viz[Generate a visual representation of your dependencies]" \
  23. "init[Generate a simple Gemfile, placed in the current directory]" \
  24. "gem[Create a simple gem, suitable for development with bundler]" \
  25. "platform[Displays platform compatibility information]" \
  26. "clean[Cleans up unused gems in your bundler directory]" \
  27. "help[Describe available tasks or one specific task]"
  28. ret=0
  29. ;;
  30. args)
  31. case $line[1] in
  32. help)
  33. _values 'commands' \
  34. 'install' \
  35. 'update' \
  36. 'package' \
  37. 'exec' \
  38. 'config' \
  39. 'check' \
  40. 'list' \
  41. 'show' \
  42. 'outdated' \
  43. 'console' \
  44. 'open' \
  45. 'viz' \
  46. 'init' \
  47. 'gem' \
  48. 'platform' \
  49. 'help' && ret=0
  50. ;;
  51. install)
  52. _arguments \
  53. '(--no-color)--no-color[disable colorization in output]' \
  54. '(--local)--local[do not attempt to connect to rubygems.org]' \
  55. '(--quiet)--quiet[only output warnings and errors]' \
  56. '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
  57. '(--system)--system[install to the system location]' \
  58. '(--deployment)--deployment[install using defaults tuned for deployment environments]' \
  59. '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
  60. '(--path)--path=-[specify a different path than the system default]:path:_files' \
  61. '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
  62. '(--without)--without=-[exclude gems that are part of the specified named group]:groups'
  63. ret=0
  64. ;;
  65. exec)
  66. _normal && ret=0
  67. ;;
  68. clean)
  69. _arguments \
  70. '(--force)--force[forces clean even if --path is not set]' \
  71. '(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \
  72. '(--no-color)--no-color[Disable colorization in output]' \
  73. '(--verbose)--verbose[Enable verbose output mode]'
  74. ret=0
  75. ;;
  76. outdated)
  77. _arguments \
  78. '(--pre)--pre[Check for newer pre-release gems]' \
  79. '(--source)--source[Check against a specific source]' \
  80. '(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \
  81. '(--no-color)--no-color[Disable colorization in output]' \
  82. '(--verbose)--verbose[Enable verbose output mode]'
  83. ret=0
  84. ;;
  85. (open|show|info)
  86. _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
  87. if [[ $_gems != "" ]]; then
  88. _values 'gems' $_gems && ret=0
  89. fi
  90. ;;
  91. *)
  92. _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
  93. _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
  94. if [[ $_opts != "" ]]; then
  95. _values 'options' $_opts && ret=0
  96. fi
  97. ;;
  98. esac
  99. ;;
  100. esac
  101. return ret