Skip to content

Instantly share code, notes, and snippets.

@DevGW
Last active March 2, 2023 14:40
Show Gist options
  • Save DevGW/9fe2c866a3dd7f76d1c5f06dd416c5d3 to your computer and use it in GitHub Desktop.
Save DevGW/9fe2c866a3dd7f76d1c5f06dd416c5d3 to your computer and use it in GitHub Desktop.
interesting #bash #prompt
parse_git_branch() {
esc=$(printf '\033')
git branch > /dev/null 2>&1
RESULT=$?
if [ $RESULT -eq 0 ]; then
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/┣━━━(\x1b[93mgit\x1b[92m)┉┉[\x1b[3;97m\1\x1b[23;92m]\n┃\n┗━/'
else
echo '┃'
echo '┗━'
fi
}
PS1='\n\[\033[;92m\]┏━━━(\[\033[;95;3m\]\u @ \h\[\033[;92m\])┉┉[\[\033[0;1m\]\w\[\033[;92m\]]\n\[\033[;92m\]$(parse_git_branch)\[\033[1;96m\]\$ \[\033[0m\]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment