mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
parent
f4378582d6
commit
0f2a2d9ada
@ -8,16 +8,13 @@ function __bobthefish_cmd_duration -S -d 'Show command duration'
|
|||||||
if [ "$CMD_DURATION" -lt 5000 ]
|
if [ "$CMD_DURATION" -lt 5000 ]
|
||||||
echo -ns $CMD_DURATION 'ms'
|
echo -ns $CMD_DURATION 'ms'
|
||||||
else if [ "$CMD_DURATION" -lt 60000 ]
|
else if [ "$CMD_DURATION" -lt 60000 ]
|
||||||
math -s1 "$CMD_DURATION/1000" | string replace -r '\\.0$' ''
|
__bobthefish_pretty_ms $CMD_DURATION s
|
||||||
echo -n 's'
|
|
||||||
else if [ "$CMD_DURATION" -lt 3600000 ]
|
else if [ "$CMD_DURATION" -lt 3600000 ]
|
||||||
set_color $fish_color_error
|
set_color $fish_color_error
|
||||||
math -s1 "$CMD_DURATION/60000" | string replace -r '\\.0$' ''
|
__bobthefish_pretty_ms $CMD_DURATION m
|
||||||
echo -n 'm'
|
|
||||||
else
|
else
|
||||||
set_color $fish_color_error
|
set_color $fish_color_error
|
||||||
math -s2 "$CMD_DURATION/3600000" | string replace -r '(\\.0)?0$' ''
|
__bobthefish_pretty_ms $CMD_DURATION h
|
||||||
echo -n 'h'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
@ -27,6 +24,28 @@ function __bobthefish_cmd_duration -S -d 'Show command duration'
|
|||||||
or echo -ns ' ' $__bobthefish_left_arrow_glyph
|
or echo -ns ' ' $__bobthefish_left_arrow_glyph
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for humans'
|
||||||
|
set -l interval_ms
|
||||||
|
set -l scale 1
|
||||||
|
|
||||||
|
switch $interval
|
||||||
|
case s
|
||||||
|
set interval_ms 1000
|
||||||
|
case m
|
||||||
|
set interval_ms 60000
|
||||||
|
case h
|
||||||
|
set interval_ms 3600000
|
||||||
|
set scale 2
|
||||||
|
end
|
||||||
|
|
||||||
|
switch $FISH_VERSION
|
||||||
|
case 2.\*
|
||||||
|
math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
|
||||||
|
case \*
|
||||||
|
math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
||||||
[ "$theme_display_date" = "no" ]; and return
|
[ "$theme_display_date" = "no" ]; and return
|
||||||
set -q theme_date_format
|
set -q theme_date_format
|
||||||
|
Loading…
Reference in New Issue
Block a user