|
|
@ -934,13 +934,11 @@ prompt_custom() {
|
|
|
|
# Display the duration the command needed to run.
|
|
|
|
# Display the duration the command needed to run.
|
|
|
|
set_default -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3
|
|
|
|
set_default -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3
|
|
|
|
set_default -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2
|
|
|
|
set_default -i POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION 2
|
|
|
|
set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_DISABLE_FORMATTING false
|
|
|
|
# Other options: "d h m s".
|
|
|
|
|
|
|
|
set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT "H:M:S"
|
|
|
|
prompt_command_execution_time() {
|
|
|
|
prompt_command_execution_time() {
|
|
|
|
(( $+P9K_COMMAND_DURATION_SECONDS && P9K_COMMAND_DURATION_SECONDS >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )) || return
|
|
|
|
(( $+P9K_COMMAND_DURATION_SECONDS && P9K_COMMAND_DURATION_SECONDS >= POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD )) || return
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $POWERLEVEL9K_COMMAND_EXECUTION_TIME_DISABLE_FORMATTING == true ]]; then
|
|
|
|
|
|
|
|
local text=''
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (( P9K_COMMAND_DURATION_SECONDS < 60 )); then
|
|
|
|
if (( P9K_COMMAND_DURATION_SECONDS < 60 )); then
|
|
|
|
if [[ $POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION == 0 ]]; then
|
|
|
|
if [[ $POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION == 0 ]]; then
|
|
|
|
local -i sec=$((P9K_COMMAND_DURATION_SECONDS + 0.5))
|
|
|
|
local -i sec=$((P9K_COMMAND_DURATION_SECONDS + 0.5))
|
|
|
@ -950,6 +948,7 @@ prompt_command_execution_time() {
|
|
|
|
local text=${sec}s
|
|
|
|
local text=${sec}s
|
|
|
|
else
|
|
|
|
else
|
|
|
|
local -i d=$((P9K_COMMAND_DURATION_SECONDS + 0.5))
|
|
|
|
local -i d=$((P9K_COMMAND_DURATION_SECONDS + 0.5))
|
|
|
|
|
|
|
|
if [[ $POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT == "H:M:S" ]]; then
|
|
|
|
local text=${(l.2..0.)$((d % 60))}
|
|
|
|
local text=${(l.2..0.)$((d % 60))}
|
|
|
|
if (( d >= 60 )); then
|
|
|
|
if (( d >= 60 )); then
|
|
|
|
text=${(l.2..0.)$((d / 60 % 60))}:$text
|
|
|
|
text=${(l.2..0.)$((d / 60 % 60))}:$text
|
|
|
@ -959,6 +958,17 @@ prompt_command_execution_time() {
|
|
|
|
text=0$((d / 3600)):$text
|
|
|
|
text=0$((d / 3600)):$text
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
local text="$((d % 60))s"
|
|
|
|
|
|
|
|
if (( d >= 60 )); then
|
|
|
|
|
|
|
|
text="$((d / 60 % 60))m $text"
|
|
|
|
|
|
|
|
if (( d >= 3600 )); then
|
|
|
|
|
|
|
|
text="$((d / 3600 % 24))h $text"
|
|
|
|
|
|
|
|
if (( d >= 86400 )); then
|
|
|
|
|
|
|
|
text="$((d / 86400))d $text"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|