Created
September 14, 2010 19:29
-
-
Save dcadenas/579617 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cd into matching gem directory ("cd -" friendly) | |
| cdgem() { | |
| local gempath=$(gem env gemdir)/gems | |
| if [[ $1 == "" ]]; then | |
| cd $gempath | |
| return | |
| fi | |
| local gem=$(ls $gempath | g $1 | sort | tail -1) | |
| if [[ $gem != "" ]]; then | |
| cd $gempath/$gem | |
| fi | |
| } | |
| _cdgem() { | |
| COMPREPLY=($(compgen -W '$(ls `gem env gemdir`/gems)' -- ${COMP_WORDS[COMP_CWORD]})) | |
| return 0; | |
| } | |
| complete -o default -o nospace -F _cdgem cdgem; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment