|
|
@ -117,25 +117,30 @@ function prompt_project() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
prompt_git(){ |
|
|
|
prompt_git(){ |
|
|
|
local branch="$(git branch --show-current 2> /dev/null)" |
|
|
|
local repoTopLevel="$(command git rev-parse --show-toplevel 2> /dev/null)" |
|
|
|
local color="green" |
|
|
|
if [ -n "$repoTopLevel" ]; then |
|
|
|
local ret="" |
|
|
|
local branch="$(git branch --show-current 2> /dev/null)" |
|
|
|
if [ -n "$branch" ]; then |
|
|
|
local tag="$(git describe --tags --exact-match HEAD 2> /dev/null)" |
|
|
|
ret="$branch" |
|
|
|
local color="green" |
|
|
|
|
|
|
|
local ret="" |
|
|
|
|
|
|
|
[ -n "$branch" ] && ret="$branch " |
|
|
|
|
|
|
|
[ -n "$tag" ] && ret+="$tag " |
|
|
|
|
|
|
|
[ -n "$ret" ] || ret="$(git rev-parse --short HEAD 2> /dev/null)" |
|
|
|
local repoTopLevel="$(command git rev-parse --show-toplevel 2> /dev/null)" |
|
|
|
local repoTopLevel="$(command git rev-parse --show-toplevel 2> /dev/null)" |
|
|
|
local untrackedFiles=$(command git ls-files --others --exclude-standard "${repoTopLevel}" 2> /dev/null) |
|
|
|
local untrackedFiles=$(command git ls-files --others --exclude-standard "${repoTopLevel}" 2> /dev/null) |
|
|
|
|
|
|
|
local modified=$(command git diff --name-only 2> /dev/null) |
|
|
|
local staged=$(command git diff --staged --name-only 2> /dev/null) |
|
|
|
local staged=$(command git diff --staged --name-only 2> /dev/null) |
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$untrackedFiles" ]; then |
|
|
|
if [ -n "$modified" ]; then |
|
|
|
ret="$ret " |
|
|
|
ret+=" " |
|
|
|
color="orange1" |
|
|
|
color="orange1" |
|
|
|
fi |
|
|
|
fi |
|
|
|
if [ -n "$staged" ]; then |
|
|
|
if [ -n "$staged" ]; then |
|
|
|
ret="$ret " |
|
|
|
ret+=" " |
|
|
|
color="orange1" |
|
|
|
color="orange1" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
ret="$(echo "$ret" | sed -e 's/ *$//')" |
|
|
|
echo "$ret" |
|
|
|
echo "$ret" |
|
|
|
echo "$color" |
|
|
|
echo "$color" |
|
|
|
} |
|
|
|
} |
|
|
@ -197,7 +202,6 @@ set_prompts(){ |
|
|
|
|
|
|
|
|
|
|
|
#Set background to nothing at the start of the prompt |
|
|
|
#Set background to nothing at the start of the prompt |
|
|
|
local background="" |
|
|
|
local background="" |
|
|
|
local foreground="" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Set the prompt to an empty string |
|
|
|
#Set the prompt to an empty string |
|
|
|
PROMPT="" |
|
|
|
PROMPT="" |
|
|
@ -224,8 +228,10 @@ set_prompts(){ |
|
|
|
PROMPT="$PROMPT$(echo "$segment" | sed -n '1p')" |
|
|
|
PROMPT="$PROMPT$(echo "$segment" | sed -n '1p')" |
|
|
|
background="$(echo "$segment" | sed -n '2p')" |
|
|
|
background="$(echo "$segment" | sed -n '2p')" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
invisibleSeperator=$(echo -e '\u2063') |
|
|
|
|
|
|
|
|
|
|
|
PROMPT="$PROMPT $(seperator "$background")$(resetColor)" |
|
|
|
PROMPT="$PROMPT $(seperator "$background")$(resetColor)$invisibleSeperator" |
|
|
|
|
|
|
|
|
|
|
|
#$(resetColor) |
|
|
|
#$(resetColor) |
|
|
|
RPROMPT="$(resetColor)$(prompt_last_exit_code "$RETVAL")$(resetColor)" |
|
|
|
RPROMPT="$(resetColor)$(prompt_last_exit_code "$RETVAL")$(resetColor)" |
|
|
|