my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB

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