2020-05-09 08:48:35 +03:00
|
|
|
function _cmd_duration -a duration threshold decimals
|
2020-11-25 20:22:35 +03:00
|
|
|
set -lx CMD_DURATION $duration
|
2020-07-12 02:45:23 +03:00
|
|
|
set -lx tide_cmd_duration_threshold $threshold
|
|
|
|
set -lx tide_cmd_duration_decimals $decimals
|
2020-05-09 08:48:35 +03:00
|
|
|
|
2020-05-22 00:58:09 +03:00
|
|
|
_tide_decolor (_tide_item_cmd_duration)
|
2020-05-09 08:48:35 +03:00
|
|
|
end
|
|
|
|
|
2020-09-13 08:46:32 +03:00
|
|
|
@test 'Less than threshold' -z (_cmd_duration 2000 3000 0)
|
2020-07-01 03:34:57 +03:00
|
|
|
@test 'Decimals' (_cmd_duration 4567 3000 3) = '4.567s'
|
|
|
|
@test 'Minutes' (_cmd_duration 456700 3000 0) = '7m 36s'
|
|
|
|
@test 'Hours' (_cmd_duration 4567000 3000 0) = '1h 16m 7s'
|