aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfiles/prompt13
1 files changed, 11 insertions, 2 deletions
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