-
Notifications
You must be signed in to change notification settings - Fork 0
/
set_prompt_with_git
executable file
·50 lines (39 loc) · 1.31 KB
/
set_prompt_with_git
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
source /home/legrady/.bash/colour.bash
# echo "End of defining functions"
POINTER=$(echo -e "-\xe2\x9e\xa4")
#echo "Pointer is $POINTER"
ANSI_color 'GREEN' 'BLACK'
PSCOLOR=$ANSI_SEQUENCE
ANSI_color 'BRIGHT' 'WHITE' 'BLACK'
PS_SEP_COLOR=$ANSI_SEQUENCE
NOCOLOR="\[\e[00m\]"
#echo -e "PSCOLOR=$PSCOLOR sample $NOCOLOR PS_SEP_COLOR=$PS_SEP_COLOR sample $NOCOLOR NOCOLOR=$NOCOLOR"
#echo "defined colors"
PS_SEP=$PS_SEP_COLOR
#PS_SEP+='|'
PS_SEP+=$(echo -e "\xe2\x94\x83")
PS_OPEN=$PS_SEP_COLOR
PS_OPEN+='['
PS_CLOSE=$PS_SEP_COLOR
PS_CLOSE+=']'
#echo "PS_SEP = $PS_SEP; PS_OPEN = $PS_OPEN; PS_CLOSE = $PS_CLOSE"
#echo "defined separators"
DATE="${PSCOLOR}\d"
TIME="${PSCOLOR}\t"
USER="${PSCOLOR}\u@\h"
WHERE="${PSCOLOR}\w"
#echo "defined components"
function gen_ps1 {
unset PS1
GITBIT=$(/home/legrady/.bash/git-status)
export PS1="${PS_SEP} ${DATE} ${PS_SEP} ${TIME} ${PS_OPEN}${USER}${PS_CLOSE} ${WHERE} ${PS_SEP} ${GITBIT} ${PS_SEP}${NOCOLOR}\n${PS_SEP}${PSCOLOR}${POINTER} ${NOCOLOR} "
}
export PROMPT_COMMAND=gen_ps1
# (c) April, 2015 Tom Legrady <Tom@TomLegrady.com>
#
# Released under
# Artistic License (http://dev.perl.org/licenses/artistic.html)
# GNU Lublic License v3 (http://www.gnu.org/licenses/).
# Use it, just don't claim you wrote it.
# END OF FILE --------------------------------------------------