blob: eaf0e8349f8f9917bdab07ad88a8a5f9b9b2060e [file] [log] [blame]
Robert R Evans76ed68d2010-10-02 12:29:17 -07001#!/bin/bash
2
Robert R Evanse0b3ef52010-10-02 12:54:15 -07003# Normal Colors
4GREEN=$'\e[0;32m'
5RED=$'\e[0;31m'
6BLUE=$'\e[0;34m'
7WHITE=$'\e[1;37m'
8BLACK=$'\e[0;30m'
9YELLOW=$'\e[0;33m'
10PURPLE=$'\e[0;35m'
11CYAN=$'\e[0;36m'
12GRAY=$'\e[1;30m'
13PINK=$'\e[37;1;35m'
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070014ORANGE=$'\e[33;40m'
15
Robert R Evanse0b3ef52010-10-02 12:54:15 -070016# Revert color back to the normal color
17NORMAL=$'\e[00m'
18
19# LIGHT COLORS
20LIGHT_BLUE=$'\e[1;34m'
21LIGHT_GREEN=$'\e[1;32m'
22LIGHT_CYAN=$'\e[1;36m'
23LIGHT_RED=$'\e[1;31m'
24LIGHT_PURPLE=$'\e[1;35m'
25LIGHT_YELLOW=$'\e[1;33m'
26LIGHT_GRAY=$'\e[0;37m'
27
28
Robert R Evans2800e7e2010-10-02 12:33:58 -070029# Stolen from Steve Losh
Robert R Evans9c7cd9a2010-10-02 11:55:34 -070030function 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
36function parse_git_dirty {
37 [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
38}
39
40function parse_git_branch {
41 git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
42}