function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
function parse_p4_branch () {
P4INITROOT=`p4 set | grep P4INITROOT`
if [ $? -eq 0 ]; then
p4 switch 2> /dev/null | sed -e 's/\(.*\)/ (\1)/'
fi
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
GRAY="\[\033[0;37m\]"
NO_COLOUR="\[\033[0m\]"
function set_prompt () {
export PS1="$GREEN\u@\h$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$GRAY\$(parse_p4_branch)$NO_COLOUR\$ "
}
export PROMPT_COMMAND=set_prompt