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