Skip to content

Instantly share code, notes, and snippets.

@roelbondoc
Created July 29, 2011 20:19
Show Gist options
  • Save roelbondoc/1114639 to your computer and use it in GitHub Desktop.
Save roelbondoc/1114639 to your computer and use it in GitHub Desktop.
bashrc ps1 setup
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
parse_rvm() {
rvm list 2> /dev/null | grep '=>' | sed -e 's/.*\s\(ruby\S*\).*/ (\1)/'
}
parse_gemset() {
rvm gemset list 2> /dev/null | grep '=>' | sed -e 's/=>\s*\(\w*\)/ (\1)/g'
}
PS1="\w\e[0;32m\$(parse_git_branch)\e[m\e[0;31m\$(parse_rvm)\e[m\e[0;34m\$(parse_gemset)\e[m\n$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment