Created
January 24, 2013 23:58
-
-
Save dnoseda/4629920 to your computer and use it in GitHub Desktop.
This file contains 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
# for gvm to autopick grails version only when cd in a grails proyect | |
alias autopick='AUTO_VERSION=`grep app.grails.version application.properties` ; AUTO_VERSION=${AUTO_VERSION:19}; gvm use grails $AUTO_VERSION' | |
chdir() { | |
local action="$1"; shift | |
case "$action" in | |
# popd needs special care not to pass empty string instead of no args | |
popd) [[ $# -eq 0 ]] && builtin popd || builtin popd "$*" ;; | |
cd) | |
if [ $# -eq 0 ] | |
then | |
builtin $action "$HOME" ; | |
else | |
builtin $action "$*"; | |
fi;; | |
pushd) builtin $action "$*" ;; | |
*) return ;; | |
esac | |
# now do stuff in the new pwd | |
if [ -f ./application.properties ] | |
then | |
autopick | |
fi | |
} | |
alias cd='chdir cd' | |
alias pushd='chdir pushd' | |
alias popd='chdir popd' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment