Hygo AI custom shell.
shows the git branch
1 file changed, +12 -1
+12-1setup.sh
| @@ -8,9 +8,20 @@ else | ||
| 8 | 8 | fi |
| 9 | 9 | cd $CURRENT_DIR |
| 10 | 10 | |
| 11 | +# Function to get the current Git branch | |
| 12 | +git_branch_str() { | |
| 13 | + git_branch=$(git branch 2>/dev/null | grep '*' | sed 's/* //') | |
| 14 | + if [ -n "$git_branch" ]; then | |
| 15 | + echo -e "($git_branch)" | |
| 16 | + fi | |
| 17 | +} | |
| 18 | + | |
| 19 | +# Set up zsh prompt | |
| 11 | 20 | if [ -n "$ZSH_VERSION" ]; then |
| 12 | 21 | PROMPT="%F{214}%n@%m %F{white}%~"$'\n'"%f$ " |
| 13 | 22 | fi |
| 23 | + | |
| 24 | +# Set up bash prompt | |
| 14 | 25 | if [ -n "$BASH_VERSION" ]; then |
| 15 | - PS1="\[\e[38;5;214m\]\u@\h \w\n\$\[\e[0m\] " | |
| 26 | + PS1="\[\e[38;5;214m\]\u@\h \w $(git_branch_str)\n\$\[\e[0m\] " | |
| 16 | 27 | fi |