_bundler 3.9 KB

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