aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-04-20 23:44:56 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-04-24 22:26:26 +0200
commitfb12aabf3e8685aaa21185b145caf431ca44b0d4 (patch)
tree1d855698837a4197be1e5b84341a3f4943fa7fb5
parentcb338c76a8eb19a3ed1a73df330c3ddf638c7c39 (diff)
global-functions: $DeviceInfo: use $FormatLine
-rw-r--r--global-functions.rsc31
1 files changed, 16 insertions, 15 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 501ea92..45fda9f 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -195,6 +195,7 @@
:global Identity;
:global IfThenElse;
+ :global FormatLine;
:local Resource [ /system/resource/get ];
:local RouterBoard;
@@ -205,27 +206,27 @@
:local Update [ /system/package/update/get ];
:return ( \
- "Hostname: " . $Identity . \
- "\nBoard name: " . $Resource->"board-name" . \
- "\nArchitecture: " . $Resource->"architecture-name" . \
+ [ $FormatLine "Hostname" $Identity ] . "\n" . \
+ [ $FormatLine "Board name" ($Resource->"board-name") ] . "\n" . \
+ [ $FormatLine "Architecture" ($Resource->"architecture-name") ] . "\n" . \
[ $IfThenElse ($RouterBoard->"routerboard" = true) \
- ("\nModel: " . $RouterBoard->"model" . \
- [ $IfThenElse ([ :len ($RouterBoard->"revision") ] > 0) \
- (" " . $RouterBoard->"revision") ] . \
- "\nSerial number: " . $RouterBoard->"serial-number") ] . \
+ ([ $FormatLine "Model" ($RouterBoard->"model") ] . \
+ [ $IfThenElse ([ :len ($RouterBoard->"revision") ] > 0) \
+ (" " . $RouterBoard->"revision") ] . "\n" . \
+ [ $FormatLine "Serial number" ($RouterBoard->"serial-number") ] . "\n") ] . \
[ $IfThenElse ([ :len ($License->"level") ] > 0) \
- ("\nLicense: " . $License->"level") ] . \
- "\nRouterOS:" . \
- "\n Channel: " . $Update->"channel" . \
- "\n Installed: " . $Update->"installed-version" . \
+ ([ $FormatLine "License" ($License->"level") ] . "\n") ] . \
+ "RouterOS:\n" . \
+ [ $FormatLine " Channel" ($Update->"channel") ] . "\n" . \
+ [ $FormatLine " Installed" ($Update->"installed-version") ] . "\n" . \
[ $IfThenElse ([ :typeof ($Update->"latest-version") ] != "nothing" && \
$Update->"installed-version" != $Update->"latest-version") \
- ("\n Available: " . $Update->"latest-version") ] . \
+ ([ $FormatLine " Available" ($Update->"latest-version") ] . "\n") ] . \
[ $IfThenElse ($RouterBoard->"routerboard" = true && \
$RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \
- ("\n Firmware: " . $RouterBoard->"current-firmware") ] . \
- "\nRouterOS-Scripts:" . \
- "\n Version: " . $ExpectedConfigVersion);
+ ([ $FormatLine " Firmware" ($RouterBoard->"current-firmware") ] . "\n") ] . \
+ "RouterOS-Scripts:\n" . \
+ [ $FormatLine " Version" $ExpectedConfigVersion ]);
}
# convert line endings, DOS -> UNIX