Add minutes and hours to cmd_duration

This commit is contained in:
Ilan Cosman 2020-05-06 12:15:45 -07:00
parent 30f787b5a8
commit 31fd9d8f85

View File

@ -22,8 +22,23 @@ function _lean_status
end
function _lean_cmd_duration
if test (math $CMD_DURATION/1000) -gt $lean_cmd_duration_threshold
echo -n (math --scale=$lean_cmd_duration_decimals $CMD_DURATION/1000)'s'
set -l seconds (math --scale=$lean_cmd_duration_decimals $CMD_DURATION/1000)
if test $seconds -gt $lean_cmd_duration_threshold
set -l secondsMod (math $seconds % 60)
set -l minutes (math -s0 $seconds/60)
set -l minutesMod (math $minutes % 60)
set -l hours (math -s0 $minutes/60)
for time in hours minutesMod secondsMod
if test $$time -eq 0
set -e $time
end
end
echo {$hours}'h' {$minutesMod}'m' {$secondsMod}'s'
end
end