Added different behavior for root prompt in git_prompt_config()

master
APraxx 12 years ago
parent 4153ec7ed7
commit 08212d8a92
  1. 18
      gitprompt.sh

@ -44,6 +44,10 @@ function git_prompt_config()
local Blue="\[\033[0;34m\]"
local Cyan="\[\033[0;36m\]"
#Checking if root to change output
_isroot=false
[[ $UID -eq 0 ]] && _isroot=true
# source the user's ~/.git-prompt-colors.sh file, or the one that should be
# sitting in the same directory as this script
@ -91,13 +95,23 @@ function git_prompt_config()
local PathShort="\w"
if [ "x${GIT_PROMPT_START}" == "x" ]; then
PROMPT_START="${Yellow}${PathShort}${ResetColor}"
#First statment is for non root behavior second for root
if ! $_isroot; then
PROMPT_START="${Yellow}${PathShort}${ResetColor}"
else
PROMPT_START="${Yellow}${PathShort}${ResetColor}"
fi
else
PROMPT_START="${GIT_PROMPT_START}"
fi
if [ "x${GIT_PROMPT_END}" == "x" ]; then
PROMPT_END=" \n${White}${Time12a}${ResetColor} $ "
#First statment is for non root behavior second for root
if ! $_isroot; then
PROMPT_END=" \n${White}${Time12a}${ResetColor} $ "
else
PROMPT_END=" \n${White}${Time12a}${ResetColor} # "
fi
else
PROMPT_END="${GIT_PROMPT_END}"
fi

Loading…
Cancel
Save