diff options
author | Christian Hesse <mail@eworm.de> | 2023-11-23 14:41:46 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-11-23 14:41:46 +0100 |
commit | 1cc0e3429b4017d97529a49a09e50487d9630929 (patch) | |
tree | 499ae77e8cc58b2d338e30e77448a416cdffccf8 /global-functions.rsc | |
parent | cae5f425a6c9d1f5797d85f6d4cd21867cc5cf8f (diff) |
global-functions: introduce $AlignRight
Diffstat (limited to 'global-functions.rsc')
-rw-r--r-- | global-functions.rsc | 14 |
1 files changed, 14 insertions, 0 deletions
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 ]; |