-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprompt.sh
30 lines (26 loc) · 947 Bytes
/
prompt.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
30
GIT_GREEN="$(tput setaf 2)"
FOLDER_CYAN="$(tput setaf 46)"
NORMAL_YELLOW="$(tput setaf 3)"
RESET="$(tput sgr0)"
if [ -d ".git" ]
then
cd .git/
branch=$( cat HEAD || true )
j=0
for i in $(echo $branch | tr "/" "\n")
do
((j++))
if [ "$j" = 4 ]
then
if [ -e logs/refs/remotes/origin/$i ]
then
export PS1='\[${NORMAL_YELLOW}\]$(whoami) • \[${FOLDER_CYAN}\]/${PWD##*/}/ → \[${GIT_GREEN}\]$i ✓ \[${RESET}$\] '
else
export PS1='\[${NORMAL_YELLOW}\]$(whoami) • \[${FOLDER_CYAN}\]/${PWD##*/}/ → \[${GIT_GREEN}\]$i ✗ \[${RESET}$\] '
fi
fi;
done;
cd ..
else
export PS1='\[${NORMAL_YELLOW}\]$(whoami) • \[${FOLDER_CYAN}\]/${PWD##*/}/\[${RESET}$\] '
fi;