From 125c13eb7c962dbd8670967c2b352fcccb8b8675 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 18 Mar 2017 14:14:35 -0300 Subject: Avoid git pw3nage --- files/prompt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'files/prompt') diff --git a/files/prompt b/files/prompt index e580ded..02f0d83 100755 --- a/files/prompt +++ b/files/prompt @@ -35,8 +35,17 @@ command_prompt() { local base_prompt="${status_color}${exit_status}${COLOR_NONE} ${COLOR_CYAN}\D{%Y%m%d %H:%M:%S}${COLOR_NONE} ${COLOR_CYAN}${debian_chroot:+($debian_chroot) }${COLOR_NONE}${COLOR_YELLOW}\u@\h${COLOR_NONE}:${COLOR_CYAN}\w" # Check if completion is available - if type __git_ps1 &> /dev/null; then - PS1="${base_prompt}$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " + # See https://github.com/njhartwell/pw3nage + #if type __git_ps1 &> /dev/null; then + if [ -x "/usr/bin/git" ]; then + #PS1="${base_prompt}$(__git_ps1 " (%s)")${COLOR_NONE} \\$ " + branch="`/usr/bin/git branch 2> /dev/null | grep '^* ' | sed -e 's/\* //' -e 's/ $//'`" + + if [ ! -z "$branch" ]; then + branch=" (${branch//[^a-z0-9\/]/-})" + fi + + PS1="${base_prompt}$branch${COLOR_NONE} \\$ " else PS1="${base_prompt}${COLOR_NONE} \\$ " fi -- cgit v1.2.3