Skip to content

Commit 41124d7

Browse files
committed
Added a utility file used in Dockerfile to augment /etc/bash.bashrc to set a prompt which won't use the whole commandline width under virtualenv.
- Legacy-Id: 10486
1 parent 2a98033 commit 41124d7

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

docker/setprompt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# set a fancy prompt
3+
PS_TIME="\A "
4+
5+
if [ "$(whoami)" = "root" ]; then
6+
PS_COLOUR='\[\033[1;31m\]'
7+
PS_END="\[\033[m\]"
8+
else
9+
PS_COLOUR="\[\033[1;34m\]"
10+
PS_END="\[\033[m\]"
11+
fi
12+
13+
if [ "$TERM" = xterm ]; then
14+
PS_XTERM="\[\033]0;\]\h:\w\007"
15+
else
16+
PS_XTERM=""
17+
fi
18+
COLOUR_RED='\[\033[1;31m\]'
19+
COLOUR_BLK='\[\033[1;30m\]'
20+
if [ "$SHLVL" -gt 1 ]; then
21+
PS_SHLVL="$(eval "printf '>%.0s' {2..$SHLVL}") "
22+
else
23+
PS_SHLVL=""
24+
fi
25+
26+
PS1="$PS_XTERM\n$COLOUR_RED$PS_SHLVL$PS_COLOUR$PS_TIME$COLOUR_RED$PS_COLOUR${VIRTUAL_ENV:+$COLOUR_RED($(basename $VIRTUAL_ENV))$PS_COLOUR }\w\n\u @ $COLOUR_BLK\h$PS_COLOUR \\$ $PS_END"

0 commit comments

Comments
 (0)