blob: 2007c9e780eb1f370ec67ca9efe3fd51705880c5 [file] [log] [blame]
Robert R Evans76ed68d2010-10-02 12:29:17 -07001#!/bin/bash
2
Robert R Evans2800e7e2010-10-02 12:33:58 -07003
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07004GREEN='\[\033[0;32m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07005RED='\[\033[0;31m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07006BLUE='\[\033[0;34m\]'
7PINK='\[\e[37;1;35m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -07008WHITE='\[\033[1;37m\]'
9BLACK='\[\033[0;30m\]'
Robert R Evans2800e7e2010-10-02 12:33:58 -070010YELLOW='\[\033[0;33m\]'
11PURPLE='\[\033[0;35m\]'
12CYAN='\[\033[0;36m\]'
13GRAY='\[\033[1;30m\]'
14NORMAL='\[\033[00m\]'
15
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070016LIGHT_BLUE='\[\033[1;34m\]'
17LIGHT_GREEN='\[\033[1;32m\]'
18LIGHT_CYAN='\[\033[1;36m\]'
19LIGHT_RED='\[\033[1;31m\]'
20LIGHT_PURPLE='\[\033[1;35m\]'
21LIGHT_YELLOW='\[\033[1;33m\]'
22LIGHT_GRAY='\[\033[0;37m\]'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070023
Robert R Evans2800e7e2010-10-02 12:33:58 -070024# Stole these from Steve Losh
25# TODO:
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070026D=$'\e[37;40m'
27PINK=$'\e[35;40m'
28GREEN=$'\e[32;40m'
29ORANGE=$'\e[33;40m'
30
Robert R Evans2800e7e2010-10-02 12:33:58 -070031# Stolen from Steve Losh
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070032function 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}