gem.plugin.zsh 927 B

1234567891011121314151617181920212223242526272829303132
  1. alias gemb="gem build *.gemspec"
  2. alias gemp="gem push *.gem"
  3. # gemy GEM 0.0.0 = gem yank GEM -v 0.0.0
  4. function gemy {
  5. gem yank $1 -v $2
  6. }
  7. # If the completion file doesn't exist yet, we need to autoload it and
  8. # bind it to `gem`. Otherwise, compinit will have already done that.
  9. if [[ ! -f "$ZSH_CACHE_DIR/completions/_gem" ]]; then
  10. typeset -g -A _comps
  11. autoload -Uz _gem
  12. _comps[docker]=_gem
  13. fi
  14. # zsh 5.5 already provides completion for `_gem`. With this we ensure that
  15. # our provided completion (which is not optimal but is enough in most cases)
  16. # is used for older versions
  17. autoload -Uz is-at-least
  18. if is-at-least 5.5; then
  19. return 0
  20. fi
  21. {
  22. # Standarized $0 handling
  23. # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
  24. 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
  25. 0="${${(M)0:#/*}:-$PWD/$0}"
  26. command cp -f "${0:h}/completions/_gem" "$ZSH_CACHE_DIR/completions/_gem"
  27. } &|