From af11a50854b7af3f9a4b1c7f4f51dafe8b89f243 Mon Sep 17 00:00:00 2001 From: OMEGA_RAZER <869111+OMEGARAZER@users.noreply.github.com> Date: Wed, 22 Feb 2023 11:24:30 -0500 Subject: [PATCH] Allow for longer command min duration (#2198) 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. --- lib/command_duration.bash | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/command_duration.bash b/lib/command_duration.bash index ec4d828d..2b5e1b4b 100644 --- a/lib/command_duration.bash +++ b/lib/command_duration.bash @@ -59,16 +59,16 @@ function _command_duration() { command_duration=0 fi - if ((command_duration > 0)); then + if ((command_duration >= COMMAND_DURATION_MIN_SECONDS)); then minutes=$((command_duration / 60)) seconds=$((command_duration % 60)) - fi - _dynamic_clock_icon "${command_duration}" - if ((minutes > 0)); then - printf "%s %s%dm %ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$minutes" "$seconds" - elif ((seconds >= COMMAND_DURATION_MIN_SECONDS)); then - printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds" + _dynamic_clock_icon "${command_duration}" + if ((minutes > 0)); then + printf "%s %s%dm %ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$minutes" "$seconds" + else + printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds" + fi fi }