From 1cc0e3429b4017d97529a49a09e50487d9630929 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 23 Nov 2023 14:41:46 +0100 Subject: global-functions: introduce $AlignRight --- global-functions.rsc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'global-functions.rsc') diff --git a/global-functions.rsc b/global-functions.rsc index 090269d..c356606 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -20,6 +20,7 @@ :global Identity [ /system/identity/get name ]; # global functions +:global AlignRight; :global CertificateAvailable; :global CertificateDownload; :global CertificateNameByCN; @@ -72,6 +73,19 @@ :global WaitFullyConnected; :global WaitTimeSync; +# align string to the right +:global AlignRight do={ + :local Input [ :tostr $1 ]; + :local Len [ :tonum $2 ]; + + :global EitherOr; + + :local Spaces " "; + :set Len [ $EitherOr $Len 8 ]; + + :return ([ :pick $Spaces 0 ($Len - [ :len $Input ]) ] . $Input); +} + # check and download required certificate :set CertificateAvailable do={ :local CommonName [ :tostr $1 ]; -- cgit v1.2.3-54-g00ecf