_bundler 3.4 KB

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