blob: 55df693552a1a9740e03320dffdccf64eac266fe [file] [log] [blame]
Karl Swedberg8ac6e442011-02-27 17:54:35 -05001#!/bin/bash
2SCM_THEME_PROMPT_DIRTY=''
3SCM_THEME_PROMPT_CLEAN=''
4SCM_GIT_CHAR='${bold_cyan}±${normal}'
5SCM_SVN_CHAR='${bold_cyan}⑆${normal}'
6SCM_HG_CHAR='${bold_red}☿${normal}'
7SCM_THEME_PROMPT_PREFIX=""
8SCM_THEME_PROMPT_SUFFIX=""
9RVM_THEME_PROMPT_PREFIX=" ("
10RVM_THEME_PROMPT_SUFFIX=")"
11
12doubletime_scm_prompt() {
13 CHAR=$(scm_char)
14 if [ $CHAR = $SCM_NONE_CHAR ]
15 then
16 return
17 else
18 echo "$(git_prompt_status)"
19 fi
20}
21
22prompt_setter() {
23 # Save history
24 history -a
25 history -c
26 history -r
27 PS1="
Travis Swicegood0c2f3092011-02-28 13:46:22 -060028\t $(scm_char) [\[$blue\]\u@${THEME_PROMPT_HOST}\[$reset_color\]] \w
Karl Swedberg8ac6e442011-02-27 17:54:35 -050029$(doubletime_scm_prompt)\[$reset_color\] $ "
30 PS2='> '
31 PS4='+ '
32}
33
34PROMPT_COMMAND=prompt_setter
35
36git_prompt_status() {
37
38 if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then
39 git_status="${bold_red}$(scm_prompt_info) ✗"
40 elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then
41 git_status="${bold_yellow}$(scm_prompt_info) ^"
42 elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then
43 git_status="${bold_cyan}$(scm_prompt_info) +"
44 elif [ -n "$(git status | grep 'nothing to commit' 2> /dev/null)" ]; then
45 git_status="${bold_green}$(scm_prompt_info) ${green}✓"
46 else
47 git_status="$(scm_prompt_info)"
48 fi
49 echo "[$git_status${normal}]"
50
51}
52
53# git_prompt_color() {
54#
55# if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then
56# git_status='${bold_red} ✗'
57# elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then
58# git_status='${bold_yellow} ^'
59# elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then
60# git_status='${bold_cyan} +'
61# else
62# git_status='${bold_green} ✓'
63# fi
64# echo $git_status
65#
66# }