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