Make fake __git_ps1 use its argument too. Try ⊸ instead of ⌥ for a git character.
dblume

dblume commited on 2021-11-02 20:30:03
Showing 1 changed files, with 3 additions and 3 deletions.

... ...
@@ -7,7 +7,7 @@ fi
7 7
 # Some devices may not have __git_ps1, so fake it
8 8
 if ! $(declare -F __git_ps1 > /dev/null); then
9 9
     __git_ps1() {
10
-        git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ ⌥\1/'
10
+        printf "$1" $(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
11 11
     }
12 12
 fi
13 13
 
... ...
@@ -16,10 +16,10 @@ if true ; then
16 16
     # I like 023 or 030 for the git branch color. See https://i.stack.imgur.com/UQVe5.png
17 17
     if [[ -n $SSH_CLIENT ]]; then
18 18
         export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93";
19
-                      else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w\[\e[38;5;030m\]$(__git_ps1 " ⌥%s")\[\e[38;5;242m\]$\[\e[0m\] '
19
+                      else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w\[\e[38;5;030m\]$(__git_ps1 " ⊸%s")\[\e[38;5;242m\]$\[\e[0m\] '
20 20
     else
21 21
         export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93";
22
-                      else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w\[\e[38;5;030m\]$(__git_ps1 " ⌥%s")\[\e[38;5;242m\]$\[\e[0m\] '
22
+                      else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w\[\e[38;5;030m\]$(__git_ps1 " ⊸%s")\[\e[38;5;242m\]$\[\e[0m\] '
23 23
     fi
24 24
 else
25 25
     export PROMPT_DIRTRIM=4
26 26