aboutsummaryrefslogtreecommitdiffstats
path: root/mod/inspectvar
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-03-07 10:57:42 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-03-07 22:26:01 +0100
commita832fd04ef085ef7e85000843a8e8fa59ce36dfb (patch)
treec977ca4b5167d8aa07dbe6bfe15fca8f467db0d9 /mod/inspectvar
parent1e6e0646e256c4acb9f8470853d0699286af010e (diff)
rename scripts and add file extension ".rsc"change-95
No functional change for the user... The migration is done automatically.
Diffstat (limited to 'mod/inspectvar')
-rw-r--r--mod/inspectvar55
1 files changed, 2 insertions, 53 deletions
diff --git a/mod/inspectvar b/mod/inspectvar
index 8bb5c5f..2da00ca 100644
--- a/mod/inspectvar
+++ b/mod/inspectvar
@@ -1,54 +1,3 @@
#!rsc by RouterOS
-# RouterOS script: mod/inspectvar
-# Copyright (c) 2020-2023 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
-
-:global InspectVar;
-:global InspectVarReturn;
-
-# inspect variable and print on terminal
-:set InspectVar do={
- :global InspectVarReturn;
- :global PrettyPrint;
-
- $PrettyPrint [ $InspectVarReturn $1 ];
-}
-
-# inspect variable and return formatted string
-:set InspectVarReturn do={
- :local Input $1;
- :local Level (0 + [ :tonum $2 ]);
-
- :global IfThenElse;
- :global InspectVarReturn;
-
- :local IndentReturn do={
- :local Prefix [ :tostr $1 ];
- :local Value [ :tostr $2 ];
- :local Level [ :tonum $3 ];
-
- :local Indent "";
- :for I from=1 to=$Level step=1 do={
- :set Indent ($Indent . " ");
- }
- :return ($Indent . "-" . $Prefix . "-> " . $Value);
- }
-
- :local TypeOf [ :typeof $Input ];
- :local Return [ $IndentReturn "type" $TypeOf $Level ];
-
- :if ($TypeOf = "array") do={
- :foreach Key,Value in=$Input do={
- :set $Return ($Return . "\n" . \
- [ $IndentReturn "key" $Key ($Level + 1) ] . "\n" . \
- [ $InspectVarReturn $Value ($Level + 2) ]);
- }
- } else={
- :if ($TypeOf != "nothing") do={
- :set $Return ($Return . "\n" . \
- [ $IndentReturn "value" [ $IfThenElse ([ :len $Input ] > 80) \
- ([ :pick $Input 0 77 ] . "...") $Input ] $Level ]);
- }
- }
- :return $Return;
-}
+#
+# dummy for migration