libin (owner)

Fork Of

gist: 48066 by anonymous

Revisions

  • d52eaa Fri Jan 16 11:24:48 -0800 2009
gist: 48068 Download_button fork
public
Public Clone URL: git://gist.github.com/48068.git
Embed All Files: show embed
snippet.sh #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
parse_git_branch() {
  RSLT=''
  GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' | awk '{print $2}'`
  if [ "$GIT_BRANCH" ]
then
GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'`
CLR='2'
if [ "$GIT_STATUS" ]
then
CLR='2'
else
CLR='1'
fi
RSLT="[3${CLR};40m[${GIT_BRANCH}]"
fi
echo $RSLT
}
 
COL=`expr $COLUMNS - 1`
LINE=''
COUNT=0
while test ${COL} -gt $COUNT
do
let COUNT++
LINE="${LINE}─"
done
 
export PS1='┌${LINE}[${COL}D────[\u@\h]─────[\t]─────[\W]─────$(parse_git_branch)───
└──> \$ '