aboutsummaryrefslogtreecommitdiffstats
path: root/check-health
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-11-19 20:24:09 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-11-19 20:24:09 +0100
commit88f9948c722ad003864470f85abf85c3e419e3c5 (patch)
tree36060b6723345812814d4a2f154519fd90d5186d /check-health
parent7adfd1b6703eeec91e829e386a65a60ec77e9c90 (diff)
check-health: handle formatting by picking from string
The mathematical way is more elegant, but just picking the char from string is shorter. 😜
Diffstat (limited to 'check-health')
-rw-r--r--check-health5
1 files changed, 1 insertions, 4 deletions
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 ];