From 88f9948c722ad003864470f85abf85c3e419e3c5 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 19 Nov 2020 20:24:09 +0100 Subject: check-health: handle formatting by picking from string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mathematical way is more elegant, but just picking the char from string is shorter. 😜 --- check-health | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'check-health') diff --git a/check-health b/check-health index d1b45d5..8dfbc16 100644 --- a/check-health +++ b/check-health @@ -19,10 +19,7 @@ :local FormatVoltage do={ :local Voltage [ :tonum $1 ]; - :if ($Voltage < 10) do={ - :return ("0." . $Voltage . "V"); - } - :return (($Voltage / 10) . "." . ($Voltage % ($Voltage / 10 * 10)) . "V"); + :return (($Voltage / 10) . "." . [ :pick $Voltage ([ :len $Voltage ] - 1) ] . "V"); } :local CheckHealthCurrent [ / system health get ]; -- cgit v1.2.3-54-g00ecf