7f69551498a78a6b30d706c89808fcd2ba000045

Author
Christopher Chow <soliah@gmail.com>
Committer
Christopher Chow <soliah@gmail.com>
Date

Message

Add tab completion for rvm.

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..bba5304a032647ca5ce34165b2ac71ceff2db5f8
  4--- /dev/null
  5+++ b/plugins/rvm/_rvm
  6@@ -0,0 +1,147 @@
  7+#compdef rvm
  8+
  9+local curcontext="$curcontext" state line cmds ret=1
 10+
 11+_arguments -C \
 12+	'(- 1 *)'{-v,--version}'[display version information]' \
 13+	'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
 14+	'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
 15+	'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
 16+	'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
 17+	'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
 18+	'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
 19+	'-e[Execute code from the command line]:code' \
 20+	'(-G)-G[root gem path to use]:path:_files' \
 21+	'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
 22+	'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
 23+	'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
 24+	'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
 25+	'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
 26+	'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
 27+	'(--head)--head[with update, updates rvm to git head version]' \
 28+	'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
 29+	'(--default)--default[with ruby select, sets a default ruby for new shells]' \
 30+	'(--debug)--debug[Toggle debug mode on for very verbose output]' \
 31+	'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
 32+	'(--force)--force[Force install, removes old install & source before install]' \
 33+	'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
 34+	'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
 35+	'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
 36+	'(--docs)--docs[with install, attempt to generate ri after installation]' \
 37+	'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
 38+	'1: :->cmds' \
 39+	'*: :->args' && ret=0
 40+
 41+case $state in
 42+	cmds)
 43+		cmds=( 
 44+            "version:show the rvm version installed in rvm_path"
 45+            "use:setup current shell to use a specific ruby version"
 46+            "reload:reload rvm source itself (useful after changing rvm source)"
 47+            "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
 48+            "update:upgrades rvm to the latest version."
 49+            "reset:remove current and stored default & system settings."
 50+            "info :show the *current* environment information for current ruby"
 51+            "current:print the *current* ruby version and the name of any gemset being used."
 52+            "debug:show info plus additional information for common issues"
 53+            "install:install one or many ruby versions"
 54+            "uninstall:uninstall one or many ruby versions, leaves their sources"
 55+            "remove:uninstall one or many ruby versions and remove their sources"
 56+            "migrate:Lets you migrate all gemsets from one ruby to another."
 57+            "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
 58+            "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
 59+            "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
 60+            "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
 61+            "snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
 62+            "disk-usage:Tells you how much disk space rvm install is using."
 63+            "tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
 64+            "docs:Tools to make installing ri and rdoc documentation easier."
 65+            "rvmrc:Tools related to managing rvmrc trust and loading."
 66+            "exec:runs an arbitrary command as a set operation."
 67+            "ruby:runs a named ruby file against specified and/or all rubies"
 68+            "gem:runs a gem command using selected ruby's 'gem'"
 69+            "rake:runs a rake task against specified and/or all rubies"
 70+            "tests:runs 'rake test' across selected ruby versions"
 71+            "specs:runs 'rake spec' across selected ruby versions"
 72+            "monitor:Monitor cwd for testing, run rake {spec,test} on changes."
 73+            "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
 74+            "rubygems:Switches the installed version of rubygems for the current ruby."
 75+            "gemdir:display the path to the current gem directory (GEM_HOME)."
 76+            "srcdir:display the path to rvm source directory (may be yanked)"
 77+            "fetch:Performs an archive / src fetch only of the selected ruby."
 78+            "list:show currently installed rubies, interactive output."
 79+            "package:Install a dependency package {readline,iconv,zlib,openssl}"
 80+            "notes:Display notes, with operating system specifics."
 81+            "export:Temporarily set an environment variable in the current shell."
 82+            "unexport:Undo changes made to the environment by 'rvm export'."
 83+        )
 84+		_describe -t commands 'rvm command' cmds && ret=0
 85+		;;
 86+	args)
 87+		case $line[1] in
 88+			(use|uninstall|remove|list)
 89+				_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
 90+				;;
 91+			(install|fetch)
 92+				_values -S , 'rubies' $(rvm list known_strings) && ret=0
 93+				;;
 94+			gemset)
 95+				if (( CURRENT == 3 )); then
 96+					_values 'gemset_commands' \
 97+                        'import' \
 98+                        'export' \
 99+                        'create' \
100+                        'copy' \
101+                        'rename' \
102+                        'empty' \
103+                        'delete' \
104+                        'name' \
105+                        'dir' \
106diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
107new file mode 100644
108index 0000000000000000000000000000000000000000..ef934d547a903728e2f91e255601b11db267f70d
109--- /dev/null
110+++ b/plugins/rvm/rvm.plugin.zsh
111@@ -0,0 +1,3 @@
112+fpath=($ZSH/plugins/rvm $fpath)
113+autoload -U compinit
114+compinit -i