_rvm 7.3 KB

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