ps1_parse_git_branch() {
  local retcode=$?
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
  return $retcode
}
# TODO: this somehow corrupts the cursor location
ps1_retcode_color() {
  local retcode=$?
  [ $? -eq 0 ] \
    && echo -e '\e[32m' \
    || echo -e '\e[33m'
  return $retcode
}
# export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(ps1_parse_git_branch)$(ps1_retcode_color)\$\[\033[00m\] '
export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(ps1_parse_git_branch)\[\033[01;32m\]\$\[\033[00m\] '

# TODO: ^ breaks interactive 'sh' with "sh: ps1_parse_git_branch: command not found"
