Created
November 13, 2012 23:45
-
-
Save pearkes/4069203 to your computer and use it in GitHub Desktop.
My shell prompt, with Vagrant and Git status.
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
# Example: http://s.jack.ly/iXhJ | |
prompt() { | |
PS1="${GREEN}\W\$(parse_git_branch) $BROWN\$(parse_vm_state) ${GREEN}→ ${GREY}" | |
PS2="\[[33;1m\]continue \[[0m[1m\]> " | |
} | |
parse_git_branch() { | |
[ -d .git ] || return 1 | |
/usr/local/bin/git symbolic-ref HEAD 2> /dev/null | sed 's#\(.*\)\/\([^\/]*\)$# \2#' | |
} | |
parse_vm_state() { | |
# Check to see if we're in a directory with vagrant | |
[ -e .vagrant ] || return 1 | |
VBoxManage showvminfo $(cat .vagrant | sed 's/.*\"\(.*\)\"[^\"]*$/\1/') --machinereadable | grep 'VMState=' | sed 's/.*"\(.*\)"[^"]*$/\1/' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment