Skip to content

Instantly share code, notes, and snippets.

@nex3
Created January 23, 2009 21:00
Show Gist options
  • Save nex3/51190 to your computer and use it in GitHub Desktop.
Save nex3/51190 to your computer and use it in GitHub Desktop.
## Rubygems documentation lookup
## From http://stephencelis.com/archive/2008/6/bashfully-yours-gem-shortcuts
gemdoc() {
local gemdir=`gem env gemdir`
gnome-open $gemdir/doc/`ls $gemdir/doc/ | grep $1 | sort | tail -1`/rdoc/index.html
}
_gemdocomplete() {
COMPREPLY=($(compgen -W '$(ls `gem env gemdir`/doc)' -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
complete -o default -o nospace -F _gemdocomplete gemdoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment