Allow for longer command min duration

Allows for setting "COMMAND_DURATION_MIN_SECONDS" to more than 60 seconds without adding to prompt. Previously always showed with lengths over 60 seconds regardless of setting.
pull/2198/head
OMEGARAZER 2023-02-20 01:27:02 -05:00
parent feb468b517
commit 12fdc4fb7a
No known key found for this signature in database
GPG Key ID: D89925310D306E35
1 changed files with 7 additions and 7 deletions

View File

@ -59,16 +59,16 @@ function _command_duration() {
command_duration=0 command_duration=0
fi fi
if ((command_duration > 0)); then if ((command_duration >= COMMAND_DURATION_MIN_SECONDS)); then
minutes=$((command_duration / 60)) minutes=$((command_duration / 60))
seconds=$((command_duration % 60)) seconds=$((command_duration % 60))
fi
_dynamic_clock_icon "${command_duration}" _dynamic_clock_icon "${command_duration}"
if ((minutes > 0)); then if ((minutes > 0)); then
printf "%s %s%dm %ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$minutes" "$seconds" printf "%s %s%dm %ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$minutes" "$seconds"
elif ((seconds >= COMMAND_DURATION_MIN_SECONDS)); then else
printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds" printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds"
fi
fi fi
} }