Well the limit of âROS TUIsâ is US-ASCII only, 16 colors, and generally working in 80x24⌠Without UTF-8 (or god-forbid codepages), the âlinesâ and âboxesâ arenât possible. So I guess Iâm targeting late-1970s/early-1980s style TUIs ![]()
What you got is [/terminal inkey timeout=1s] as an âevent loopâ and when the timeout= hit, you can do a ârefreshâ a screen using â:putâ. :put does support ANSI colors, using my $CHALK function (or reduced version in $c0lor above) & â\tâ will align text to 8 char columns automatically, so you can use that to align columns. $lsbridge above âtrimsâ everything to 7 chars is main âtrickâ to keep it aligned in columnsâŚ
Now what made TUIs slightly easier is the newest :convert and :[de]serialize methods, along with :ask (which isnât used here). Specifically :convertâs âbyte-arrayâ, which let you treat a RouterOS string as a âarray of charâ & :serialize, essentially, let you do all sorts of array transformations, including using [:convert $myarr to=dsv delimator=â\tâ] which is used to print âtable rowsâ. But that why these script require 7.17 (or 7.18 in case of $lsbridge, since that needs options=dsv.remap to deal with a âlist-of-dictionariesâ from the âprint as-valueâ arrays). Rending the colors does get messy & dealing with alignment â why Iâm kinda trying a few different approachesâŚ
I think Iâm working to âtopâ like interface to do âmonitoringâ which often where using winbox/CLI is sometimes lacking. While âprintâ's more advanced follow does let you do a lot - in fact I use a similar trick to @optioâs bridge vlan to show colors in traefik containers log. The problem, I think, is when you want to âwatchâ a few different parts of the config at the same time in same place at same time where the ânormalâ CLI print things donât help.
While MCâs UI styling is a no-go⌠most of the âcommand treeâ can be render using some combo of â/console/inspectâ things with my $QKEYS and $INQUIRE functions. I havenât done this since there actually a lot of way to use the same RouterOS attributes⌠But itâs possible with some ârendering functionâ for data from various âgetâ/âprint as-valueâ on a loop of /console/inspect to something like MCâs âleft sideâ. Another trick is the out put of a commandâs âgetâ without any attribute return a set of âactiveâ ones, like if IGMP or DHCP sniffer is disabled, the associated timeout/etc attribute arenât in the array â so that help in rendering things a bit too.
My âneedsâ are often it takes some complex combo of commands to âshowâ something meaningfully or setting a bunch of windows, etc etc. The VLAN bridge is one of the main ones it take me parsing a lot of the config the figure out whatâs being tagged/untagged⌠Making $lsbridge interactive â likely named â$topbridgeâ â is something Iâd like to do⌠Rendering all of RouterOS, well, maybe one day. Basically Iâd like to add some kinda UNIX âtopâ like UI for more commands as the next things. You play a tune using $PIANO - interactive âplayer pianoâ or watch something on $ROKU while you wait ![]()