-
Notifications
You must be signed in to change notification settings - Fork 1
/
prompt.sh
37 lines (32 loc) · 1 KB
/
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
31
32
33
34
35
36
37
prompt_function() {
local BLUE='\[\033[01;34m\]'
local RED='\[\033[0;31m\]'
local LIGHT_RED='\[\033[1;31m\]'
local GREEN='\[\033[0;32m\]'
local BRIGHT_GREEN='\[\033[01;32m\]'
local LIGHT_GREEN='\[\033[1;32m\]'
local YELLOW='\[\033[0;33m\]'
local WHITE='\[\033[1;37m\]'
local LIGHT_GRAY='\[\033[0;37m\]'
local GRAY='\[\033[1;30m\]'
local RESET='\[\033[0m\]'
if test $(git status 2> /dev/null | grep -c :) -eq 0; then
git_color="${GREEN}"
else
git_color="${RED}"
fi
PS1="${BLUE}\u${LIGHT_GRAY}@${GRAY}\h${RESET} : ${LIGHT_GREEN}$AWS_PROFILE${git_color}$(__git_ps1)${YELLOW}\w${RESET}\$ "
# Adds $AWS_PROFILE and $TERMINAL_COMMENT to the terminal title
if [ -z "$AWS_PROFILE" ]; then
awsenv=""
else
awsenv=" : $AWS_PROFILE"
fi
if [ -z "$TERMINAL_COMMENT" ]; then
comment=""
else
comment=" ($TERMINAL_COMMENT)"
fi
echo -ne "\033]0;${PWD##*/}$comment$awsenv\007"
}
PROMPT_COMMAND=prompt_function