Robert R Evans | a4d0242 | 2010-10-02 15:07:29 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Normal Colors |
| 4 | GREEN=$'\e[0;32m' |
| 5 | RED=$'\e[0;31m' |
| 6 | BLUE=$'\e[0;34m' |
| 7 | WHITE=$'\e[1;37m' |
| 8 | BLACK=$'\e[0;30m' |
| 9 | YELLOW=$'\e[0;33m' |
| 10 | PURPLE=$'\e[0;35m' |
| 11 | CYAN=$'\e[0;36m' |
| 12 | GRAY=$'\e[1;30m' |
| 13 | PINK=$'\e[37;1;35m' |
| 14 | ORANGE=$'\e[33;40m' |
| 15 | |
| 16 | # Revert color back to the normal color |
| 17 | NORMAL=$'\e[00m' |
| 18 | |
| 19 | # LIGHT COLORS |
| 20 | LIGHT_BLUE=$'\e[1;34m' |
| 21 | LIGHT_GREEN=$'\e[1;32m' |
| 22 | LIGHT_CYAN=$'\e[1;36m' |
| 23 | LIGHT_RED=$'\e[1;31m' |
| 24 | LIGHT_PURPLE=$'\e[1;35m' |
| 25 | LIGHT_YELLOW=$'\e[1;33m' |
| 26 | LIGHT_GRAY=$'\e[0;37m' |
| 27 | |
| 28 | |
| 29 | # Stolen from Steve Losh |
| 30 | function prompt_char { |
| 31 | git branch >/dev/null 2>/dev/null && echo '±' && return |
| 32 | hg root >/dev/null 2>/dev/null && echo '☿' && return |
| 33 | echo '○' |
| 34 | } |
| 35 | |
| 36 | function parse_git_dirty { |
| 37 | [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" |
| 38 | } |
| 39 | |
| 40 | function parse_git_branch { |
| 41 | git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
| 42 | } |