diff --git a/git-prompt-colors.sh b/git-prompt-colors.sh index bd3b5ac..88680c4 100644 --- a/git-prompt-colors.sh +++ b/git-prompt-colors.sh @@ -1,7 +1,6 @@ # These are the color definitions used by gitprompt.sh define_git_prompt_colors() { - Time12a="\$(date +%H:%M)" PathShort="\w" @@ -20,6 +19,12 @@ define_git_prompt_colors() { GIT_PROMPT_STASHED="${BoldBlue}⚑ " # the number of stashed files/dir GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo + # For the command indicator, the placeholder _LAST_COMMAND_STATE_ + # will be replaced with the exit code of the last command + # e.g. + # GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 + # GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 + GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0 GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0 diff --git a/gitprompt.sh b/gitprompt.sh index 4d57920..ed1a5bb 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -95,9 +95,9 @@ function git_prompt_config() if [ "$GIT_PROMPT_SHOW_LAST_COMMAND_INDICATOR" = 1 ]; then if [ $GIT_PROMPT_LAST_COMMAND_STATE = 0 ]; then - LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_OK}"; + LAST_COMMAND_INDICATOR="$GIT_PROMPT_COMMAND_OK"; else - LAST_COMMAND_INDICATOR="${GIT_PROMPT_COMMAND_FAIL}"; + LAST_COMMAND_INDICATOR="$GIT_PROMPT_COMMAND_FAIL"; fi # replace _LAST_COMMAND_STATE_ token with the actual state @@ -329,7 +329,7 @@ function gp_install_prompt { esac fi - if [ "x${GIT_PROMPT_SHOW_LAST_COMMAND_INDICATOR}" == "x1" ]; then + if [ "$GIT_PROMPT_SHOW_LAST_COMMAND_INDICATOR" = 1 ]; then local setLastCommandStateEntry="setLastCommandState" case ";$PROMPT_COMMAND;" in *";$setLastCommandStateEntry;"*)