dblume commited on 2022-01-19 20:13:56
Showing 1 changed files, with 11 additions and 15 deletions.
... | ... |
@@ -39,26 +39,22 @@ GIT_PS1_SHOWUPSTREAM="auto" |
39 | 39 |
GIT_PS1_SHOWDIRTYSTATE="true" |
40 | 40 |
GIT_PS1_STATESEPARATOR="" |
41 | 41 |
|
42 |
-# Experimenting with git branch in PS1. Turn off by setting to false. |
|
43 |
-if true ; then |
|
44 |
- export PROMPT_DIRTRIM=1 |
|
42 |
+# Trim everything before the dash, then trim everything after the colon. |
|
43 |
+SHORT_DOCKER_VER=${DOCKER_VER#*-} |
|
44 |
+SHORT_DOCKER_VER="🐳 \e[0;36m${SHORT_DOCKER_VER%:*}" |
|
45 |
+ |
|
46 |
+export PROMPT_DIRTRIM=2 |
|
45 | 47 |
# I like 023 or 030 for the git branch color. See https://i.stack.imgur.com/UQVe5.png |
46 | 48 |
if [[ -n $SSH_CLIENT ]]; then |
47 | 49 |
export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
48 |
- else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$(__git_ps1 " \[\e[38;5;030m\]%s\[\e[38;5;242m\]")$\[\e[0m\] ' |
|
49 |
- else |
|
50 |
- export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
51 |
- else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w$(__git_ps1 " \[\e[38;5;030m\]%s\[\e[38;5;242m\]")$\[\e[0m\] ' |
|
52 |
- fi |
|
53 |
-else |
|
54 |
- export PROMPT_DIRTRIM=4 |
|
55 |
- if [[ -n $SSH_CLIENT ]]; then |
|
56 |
- export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
57 |
- else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$\[\e[0m\] ' |
|
50 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; |
|
51 |
+ fi)$(if [ -n "$DOCKER_VER" ]; then echo -e " $SHORT_DOCKER_VER"; |
|
52 |
+ fi) \[\e[38;5;242m\]\h:\w$(__git_ps1 " \[\e[38;5;030m\]%s\[\e[38;5;242m\]")$\[\e[0m\] ' |
|
58 | 53 |
else |
59 | 54 |
export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
60 |
- else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w$\[\e[0m\] ' |
|
61 |
- fi |
|
55 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; |
|
56 |
+ fi)$(if [ -n "$DOCKER_VER" ]; then echo -e " $SHORT_DOCKER_VER"; |
|
57 |
+ fi) \[\e[38;5;242m\]\w$(__git_ps1 " \[\e[38;5;030m\]%s\[\e[38;5;242m\]")$\[\e[0m\] ' |
|
62 | 58 |
fi |
63 | 59 |
|
64 | 60 |
set -o vi |
65 | 61 |