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\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
MAGENTA="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"
GRAY="\[\033[0;37m\]"
NO_COLOUR="\[\033[0m\]"
BRIGHTRED="\[\033[0;31;1m\]"
BRIGHTGREEN="\[\033[0;32;1m\]"
BRIGHTYELLOW="\[\033[0;33;1m\]"
BRIGHTBLUE="\[\033[0;34;1m\]"
BRIGHTMAGENTA="\[\033[0;35;1m\]"
BRIGHTCYAN="\[\033[0;36;1m\]"
BRIGHTGRAY="\[\033[0;37;1m\]"
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