blob: 70302431ed6c10a423c617e956dd5ef6e0ef1a17 [file] [log] [blame]
Robert R Evans76ed68d2010-10-02 12:29:17 -07001#!/bin/bash
2
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07003# Some Colors
Robert R Evansc1d31172010-10-02 12:31:01 -07004BOLD_GREEN='\[\033[1;32m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07005GREEN='\[\033[0;32m\]'
Robert R Evansc1d31172010-10-02 12:31:01 -07006BOLD_RED='\[\033[1;31m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07007RED='\[\033[0;31m\]'
Robert R Evansc1d31172010-10-02 12:31:01 -07008BOLD_BLUE='\[\033[1;34m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07009BLUE='\[\033[0;34m\]'
10PINK='\[\e[37;1;35m\]'
11NORMAL='\[\033[00m\]'
12
13WHITE='\[\033[1;37m\]'
14BLACK='\[\033[0;30m\]'
15LIGHT_BLUE='\[\033[1;34m\]'
16LIGHT_GREEN='\[\033[1;32m\]'
17LIGHT_CYAN='\[\033[1;36m\]'
18LIGHT_RED='\[\033[1;31m\]'
19LIGHT_PURPLE='\[\033[1;35m\]'
20LIGHT_YELLOW='\[\033[1;33m\]'
21LIGHT_GRAY='\[\033[0;37m\]'
22YELLOW='\[\033[0;33m\]'
23PURPLE='\[\033[0;35m\]'
24CYAN='\[\033[0;36m\]'
25GRAY='\[\033[1;30m\]'
26
27D=$'\e[37;40m'
28PINK=$'\e[35;40m'
29GREEN=$'\e[32;40m'
30ORANGE=$'\e[33;40m'
31
32function prompt_char {
33 git branch >/dev/null 2>/dev/null && echo '±' && return
34 hg root >/dev/null 2>/dev/null && echo '☿' && return
35 echo '○'
36}
37
38function parse_git_dirty {
39 [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
40}
41
42function parse_git_branch {
43 git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
44}