clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
206 stars 69 forks source link

information output #502

Open khromenokroman opened 4 months ago

khromenokroman commented 4 months ago

Good afternoon

now it looks like this

set system conf-order 0
set system conf-order 0 script interfaces
set system conf-order 1
set system conf-order 1 script arp_table
set system conf-order 2
set system conf-order 2 script arp_aging
set system conf-order 3
set system conf-order 3 script static_routes
set system conf-order 4
set system conf-order 4 script static_routes

is it possible to remove the first lines with numbers using the compress function

olofhagsand commented 3 months ago

Are you referring to "the compress function" with the compress rules as described here: https://clixon-docs.readthedocs.io/en/latest/cli.html#compress-rules? Also, I guess what you want to achieve is replacing eg:

  set system conf-order 0
  set system conf-order 0 script interfaces

with simply:

set system conf-order 0 script interfaces

If so, I would say no, since the compress rules are an effort to remove intermediate syntax. For example, if you wanted to remove the "script" keyword in the output syntax, you could create such a compress rule.

The reason why the extra line is there has to do with how the xml2cli output function is written: https://github.com/clicon/clixon/blob/427a7db88a529ba83df2ff525faf9b9b0d0b9523/apps/cli/cli_show.c#L1606 with some extra complexity one could skip that extra printed line. Again I am not sure this was actually your question?