From d87e9486f8a127f06dd576000c9f1a3eb0be6bd3 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 2 Sep 2017 23:29:47 -0700 Subject: [PATCH] Fix command duration in Fish 3.x Drive-by: fix string replacement regex for rounding off >1h. Fixes #105 --- fish_right_prompt.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fish_right_prompt.fish b/fish_right_prompt.fish index 543c35d..e47b537 100644 --- a/fish_right_prompt.fish +++ b/fish_right_prompt.fish @@ -8,15 +8,15 @@ function __bobthefish_cmd_duration -S -d 'Show command duration' if [ "$CMD_DURATION" -lt 5000 ] echo -ns $CMD_DURATION 'ms' else if [ "$CMD_DURATION" -lt 60000 ] - math "scale=1;$CMD_DURATION/1000" | string replace -r '\\.0$' '' + math -s1 "$CMD_DURATION/1000" | string replace -r '\\.0$' '' echo -n 's' else if [ "$CMD_DURATION" -lt 3600000 ] set_color $fish_color_error - math "scale=1;$CMD_DURATION/60000" | string replace -r '\\.0$' '' + math -s1 "$CMD_DURATION/60000" | string replace -r '\\.0$' '' echo -n 'm' else set_color $fish_color_error - math "scale=2;$CMD_DURATION/3600000" | string replace -r '\\.0$' '' + math -s2 "$CMD_DURATION/3600000" | string replace -r '(\\.0)?0$' '' echo -n 'h' end