1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

global-functions: introduce function $PrettyPrint

... to add trailing carriage return when printing to terminal:

[admin@MikroTik] > $PrettyPrint [ $DeviceInfo ]
Hostname:       MikroTik
Board name:     hAP ac^2
Architecture:   arm
Model:          RouterBOARD D52G-5HacD2HnD-TC
Serial number:  8A2A09A221A1
RouterOS:
    Channel:    testing
    Installed:  7.4rc1
RouterOS-Scripts:
    Current:    81
This commit is contained in:
Christian Hesse
2022-07-05 12:29:29 +02:00
parent b0992da03d
commit eda75f0bbc

View File

@ -40,6 +40,7 @@
:global MkDir;
:global NotificationFunctions;
:global ParseKeyValueStore;
:global PrettyPrint;
:global QuotedPrintable;
:global RandomDelay;
:global Read;
@ -648,6 +649,15 @@
:return $Result;
}
# print lines with trailing carriage return
:set PrettyPrint do={
:local Input [ :tostr $1 ];
:global CharacterReplace;
:put [ $CharacterReplace $Input ("\n") ("\n\r") ];
}
# convert string to quoted-printable
:global QuotedPrintable do={
:local Input [ :tostr $1 ];