Merge pull request #127 from meermanr/master

_LAST_COMMAND_INDICATOR_ now displays symbolic names of signals
master
Martin Gondermann 11 years ago
commit 45dce86788
  1. 19
      gitprompt.sh

@ -185,6 +185,24 @@ git_prompt_reset() {
done done
} }
# gp_format_exit_status RETVAL
#
# echos the symbolic signal name represented by RETVAL if the process was
# signalled, otherwise echos the original value of RETVAL
gp_format_exit_status() {
local RETVAL="$1"
local SIGNAL
# Suppress STDERR in case RETVAL is not an integer (in such cases, RETVAL
# is echoed verbatim)
if [ "${RETVAL}" -gt 128 ] 2>/dev/null; then
SIGNAL=$(( ${RETVAL} - 128 ))
kill -l "${SIGNAL}" 2>/dev/null || echo "${RETVAL}"
else
echo "${RETVAL}"
fi
}
function git_prompt_config() function git_prompt_config()
{ {
#Checking if root to change output #Checking if root to change output
@ -214,6 +232,7 @@ function git_prompt_config()
fi fi
# replace _LAST_COMMAND_STATE_ token with the actual state # replace _LAST_COMMAND_STATE_ token with the actual state
GIT_PROMPT_LAST_COMMAND_STATE=$(gp_format_exit_status ${GIT_PROMPT_LAST_COMMAND_STATE})
LAST_COMMAND_INDICATOR="${LAST_COMMAND_INDICATOR//_LAST_COMMAND_STATE_/${GIT_PROMPT_LAST_COMMAND_STATE}}" LAST_COMMAND_INDICATOR="${LAST_COMMAND_INDICATOR//_LAST_COMMAND_STATE_/${GIT_PROMPT_LAST_COMMAND_STATE}}"
# Do this only once to define PROMPT_START and PROMPT_END # Do this only once to define PROMPT_START and PROMPT_END

Loading…
Cancel
Save