home-config/fish/functions/_tide_item_cmd_duration.fish

d3fc4f944422d2357540377eabc6867dd7a182ed · 588 B · 12 lines raw

1 function _tide_item_cmd_duration
2 test $CMD_DURATION -gt $tide_cmd_duration_threshold && t=(
3 math -s0 "$CMD_DURATION/3600000" # Hours
4 math -s0 "$CMD_DURATION/60000"%60 # Minutes
5 math -s$tide_cmd_duration_decimals "$CMD_DURATION/1000"%60) if test $t[1] != 0
6 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[1]h $t[2]m $t[3]s"
7 else if test $t[2] != 0
8 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[2]m $t[3]s"
9 else
10 _tide_print_item cmd_duration $tide_cmd_duration_icon' ' "$t[3]s"
11 end
12 end