Created
March 31, 2014 20:59
-
-
Save CoreyTrombley/9902098 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
function vpause () { | |
VBoxManage list vms | grep "$1" | cut -d' ' -f1 | tr -d '"\n ' | xargs -0 -I BOX VBoxManage controlvm BOX pause | |
} | |
function vresume () { | |
VBoxManage list vms | grep "$1" | cut -d' ' -f1 | tr -d '"\n ' | xargs -0 -I BOX VBoxManage controlvm BOX resume | |
} | |
function vrunning () { | |
VBoxManage list runningvms | grep "$1" | cut -d' ' -f1 | tr -d '"\n ' | wc -w | tr -d ' ' | |
} | |
function abbr() { | |
DIR_PREFIX="$HOME/PATH/TO/DIR/WITH/VAGRANTFILE" | |
#the point of the following line is to allow you to type ``proj src`` to get to the code dir quickly | |
SRC_PREFIX="$DIR_PREFIX/PATH/TO/SOURCE" | |
if [ "$1" = "" ]; then | |
cd "$DIR_PREFIX" | |
elif [ "$1" = "src" ]; then | |
cd "$SRC_PREFIX" | |
elif [ "$1" = "img" ]; then | |
cd "$SRC_PREFIX/PATH/TO/IMAGES" | |
elif [ "$1" = "j2" ]; then | |
cd "$SRC_PREFIX/PATH/TO/TEMPLATES" | |
elif [ "$1" = "js" ]; then | |
cd "$SRC_PREFIX/PATH/TO/JAVASCRIPT" | |
elif [ "$1" = "pause" ]; then | |
vpause | |
elif [ "$1" = "resume" ]; then | |
vresume | |
elif [ "$1" = "ssh" ]; then | |
if [[ `expr vrunning` -ne 0 ]]; then | |
cd "$DIR_PREFIX" && vagrant ssh | |
else | |
cd "$DIR_PREFIX" && vagrant up && vagrant ssh | |
fi | |
else | |
cd "$DIR_PREFIX" && vagrant "$1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment