-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_prompt
executable file
·50 lines (43 loc) · 1.17 KB
/
.bash_prompt
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# if PS1_Host doesn't exist, set it
# if on laptop, default to 'laptop' else ask
ps1host=""
if [ -n "${PS1_Host:-x}" ]
then
$(hostname | grep dbianco > /dev/null 2>&1)
if [ $? -eq 0 ]
then
PS1_Host="laptop"
else
if [ -n "${ps1host:-x}" ]
then
echo "Set ps1host var in .bash_prompt"
fi
PS1_Host=$ps1host
fi
export PS1_Host
fi
source ~/.bash_colors
if [ -f ~/.git_prompt ]; then
PROMPT_COMMAND='Git_Repo=$(git config --get remote.origin.url)'
export GIT_PS1_SHOWDIRTYSTATE="true"
#export GIT_PS1_SHOWUPSTREAM="auto"
source ~/.git_prompt
# PROMPT
PS1=${Cyan}${PS1_Host}'$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
if [ "$?" -eq "0" ]; then \
# @4 - Clean repository - nothing to commit
echo "'${Green}'"$(__git_ps1 " (${Git_Repo} | %s)"); \
else \
# @5 - Changes to working tree
echo "'${IRed}'"$(__git_ps1 " {${Git_Repo} | %s}"); \
fi) '${Color_Off}'\$ "; \
else \
# @2 - Prompt when not in GIT repo
echo "'${Red}' \w'${Color_Off}' \$ "; \
fi)'
else
PS1=${BGreen}${PS1_Host}${Color_Off}" \$ "
fi