global-functions: introduce $AlignRight

This commit is contained in:
Christian Hesse 2023-11-23 14:41:46 +01:00
parent cae5f425a6
commit 1cc0e3429b

View file

@ -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 ];