mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-01 09:13:54 +00:00
fix(bash): last command status and command duration (#1185)
* fix: character module last command status for bash * fix: command duration module for bash
This commit is contained in:
parent
27ba0accaf
commit
525dfef9a7
@ -34,6 +34,8 @@ starship_precmd() {
|
|||||||
# Run the bash precmd function, if it's set. If not set, evaluates to no-op
|
# Run the bash precmd function, if it's set. If not set, evaluates to no-op
|
||||||
"${starship_precmd_user_func-:}"
|
"${starship_precmd_user_func-:}"
|
||||||
|
|
||||||
|
eval "$_PRESERVED_PROMPT_COMMAND"
|
||||||
|
|
||||||
# Prepare the timer data, if needed.
|
# Prepare the timer data, if needed.
|
||||||
if [[ $STARSHIP_START_TIME ]]; then
|
if [[ $STARSHIP_START_TIME ]]; then
|
||||||
STARSHIP_END_TIME=$(::STARSHIP:: time)
|
STARSHIP_END_TIME=$(::STARSHIP:: time)
|
||||||
@ -70,8 +72,12 @@ else
|
|||||||
if [[ -z "$PROMPT_COMMAND" ]]; then
|
if [[ -z "$PROMPT_COMMAND" ]]; then
|
||||||
PROMPT_COMMAND="starship_precmd"
|
PROMPT_COMMAND="starship_precmd"
|
||||||
elif [[ "$PROMPT_COMMAND" != *"starship_precmd" ]]; then
|
elif [[ "$PROMPT_COMMAND" != *"starship_precmd" ]]; then
|
||||||
# Remove any trailing semicolon before appending (PR #784)
|
# Appending to PROMPT_COMMAND breaks exit status ($?) checking.
|
||||||
PROMPT_COMMAND="${PROMPT_COMMAND%;};starship_precmd;"
|
# Prepending to PROMPT_COMMAND breaks "command duration" module.
|
||||||
|
# So, we are preserving the existing PROMPT_COMMAND
|
||||||
|
# which will be executed later in the starship_precmd function
|
||||||
|
_PRESERVED_PROMPT_COMMAND="$PROMPT_COMMAND"
|
||||||
|
PROMPT_COMMAND="starship_precmd"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user