Browse code

Merge branch 'gem_plugin'

Daniel Schauenberg authored on 01/09/2010 at 11:21:44
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,64 @@
0
+#compdef gem
1
+#autoload
2
+
3
+# gem zsh completion, based on homebrew completion
4
+
5
+_gem_installed() {
6
+  installed_gems=(`gem list --local --no-versions`)
7
+}
8
+
9
+local -a _1st_arguments
10
+_1st_arguments=(
11
+  'cert:Manage RubyGems certificates and signing settings'
12
+  'check:Check installed gems'
13
+  'cleanup:Clean up old versions of installed gems in the local repository'
14
+  'contents:Display the contents of the installed gems'
15
+  'dependency:Show the dependencies of an installed gem'
16
+  'environment:Display information about the RubyGems environment'
17
+  'fetch:Download a gem and place it in the current directory'
18
+  'generate_index:Generates the index files for a gem server directory'
19
+  'help:Provide help on the `gem` command'
20
+  'install:Install a gem into the local repository'
21
+  'list:Display gems whose name starts with STRING'
22
+  'lock:Generate a lockdown list of gems'
23
+  'mirror:Mirror a gem repository'
24
+  'outdated:Display all gems that need updates'
25
+  'owner:Manage gem owners on RubyGems.org.'
26
+  'pristine:Restores installed gems to pristine condition from files located in the gem cache'
27
+  'push:Push a gem up to RubyGems.org'
28
+  'query:Query gem information in local or remote repositories'
29
+  'rdoc:Generates RDoc for pre-installed gems'
30
+  'search:Display all gems whose name contains STRING'
31
+  'server:Documentation and gem repository HTTP server'
32
+  'sources:Manage the sources and cache file RubyGems uses to search for gems'
33
+  'specification:Display gem specification (in yaml)'
34
+  'stale:List gems along with access times'
35
+  'uninstall:Uninstall gems from the local repository'
36
+  'unpack:Unpack an installed gem to the current directory'
37
+  'update:Update the named gems (or all installed gems) in the local repository'
38
+  'which:Find the location of a library file you can require'
39
+)
40
+
41
+local expl
42
+local -a gems installed_gems
43
+
44
+_arguments \
45
+  '(-v --version)'{-v,--version}'[show version]' \
46
+  '(-h --help)'{-h,--help}'[show help]' \
47
+  '*:: :->subcmds' && return 0
48
+
49
+if (( CURRENT == 1 )); then
50
+  _describe -t commands "gem subcommand" _1st_arguments
51
+  return
52
+fi
53
+
54
+case "$words[1]" in
55
+  list)
56
+      if [[ "$state" == forms ]]; then
57
+        _gem_installed
58
+        _requested installed_gems expl 'installed gems' compadd -a installed_gems
59
+      fi ;;
60
+  uninstall|update)
61
+    _gem_installed
62
+    _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;;
63
+esac
0 64
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+# add brew completion function to path
1
+fpath=($ZSH/functions/gem $fpath)
2
+autoload -U compinit
3
+compinit -i