Skip to content

Instantly share code, notes, and snippets.

@pearkes pearkes/gist:4069203
Created Nov 13, 2012

Embed
What would you like to do?
My shell prompt, with Vagrant and Git status.
# 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
You can’t perform that action at this time.