Set a default value for screen-width?

By default it appears “show cli” would indicate that the screen-width is read from the terminal directly. But this is causing some confusion for folks using various clients who’s window is less wide than their client is telling the confd interface. The problem starts when their viewable area is, say, 76 columns, but their client is telling the terminal is it 200 or greater. That causes their view of the confd cli output to go way off to the right, and then they have to scroll around, and this makes the report less easy for some folks to work with.

I realize the user could “screen-width 76” every time they log in, and remember to do so, and that’s presenting a challenge as well.

Is it possible to set a default value for screen-width so that:
1. the default value is not overrridden by the terminal window dimension.
2. If the user chooses to, they can set the set the screen-width to whatever they want,
just like normal.

Thanks,

-Donald

You can add a simple clispec that use the “maapi” command to change the screen-width at startup:

$ cat screen-width.cli
<clispec xmlns="http://tail-f.com/ns/clispec/1.0" style="c">
  <operationalMode>
    <start>
      <callback>
        <exec>
          <osCommand>maapi</osCommand>
          <args>--clicmd 'screen-width 76'</args>
        </exec>
      </callback>
    </start>
  </operationalMode>
  <configureMode/>
</clispec>

See the clispec(5) and maapi(1) man pages if you want more details.

Regards,
Conny

I got some feedback that this would not be suitable after all. Sure seemed like it would be, but it turns out we want it to apply to exactly one schema path.

I noticed that there’s a tail-f extension(tailf:cli-column-width). So if I have a yang file (please bear with me: I’m still new at this stuff) and it has something like:

grouping object-os-motivator {
    leaf  version-os-motivator {
        type string;
    }
    uses image-os-motivator;
}

The very-wide output comes from image-os-motivator: its got a LOT of columns. And this is apparently the only object having this problem.

Is it possible to use tailf:cli-column-width to cause this to wrap at column 76? And if so, can you suggest how to apply it at this level? (I seem to recall I can’t do it at grouping level, but I can do it where the grouping is used).

tailf:cli-column-width will just set the column width for one leaf (column) at a time. See the tailf_yang_cli_extensions(5) man page.

I’m guessing there is a table rendered for a list that contain a lot of leafs (columns) which is the issue here?
Have you considered suppressing that troublesome auto-rendered table using “tailf:cli-suppress-table” with the list?
That way Name-Value rendering will always be used for the list

I didn’t know of its existence before now. The change will apply to operational data, not config.
I found the jdemo.yang in the cli/show_templates example code, which reads like:

    container arp {
        config false;
        tailf:callpoint jarp-data;
        tailf:cli-show-template
            "$(/default/ip?$(/default/ifname?Default host - "
            +"$(../default/ip)/$(../default/ifname)\\\\:\n"
            +"$(arpe{$(/default/ip) $(/default/ifname)}|show)):$(arpe|show))";
        list arpe {
            key "ip ifname";
            max-elements 1024;
            tailf:cli-suppress-table;
            tailf:cli-show-template-enter "";
            tailf:cli-show-template-legend
                "Address         Interface   "
                +"$(.selected~=hwaddr?HW Address         )"
                +"$(.selected~=permanent?Permant  )"
[...]

I’m a bit daunted by this because of the scale of the number of modifications I will have to make to do this in our code base, made worse because of my newness to confd. I kept looking, and then I saw jdemo.yang in cli/climods:

    container arp0 {
        config false;
        tailf:callpoint jarp-data;
        list arpe {
            key "ip ifname";
            max-elements 1024;
            tailf:cli-compact-stats {
                tailf:cli-wrap;
                tailf:cli-width "80";
                tailf:cli-delimiter ":";
                tailf:cli-prettify;
                tailf:cli-spacer "  ";
            }
            tailf:cli-suppress-table;
[...]

Comparing the above approaches, the latter is more attractive because of its simplicity, while the former would require a significantly bigger coding and testing effort. I prefer the latter, if it is possible to use for my situation.

The underlying problem appears to be that many nested lists are being conflated up onto the same line, rather than wrapped where desired. It can be fixed by manually setting screen-width, but that impacts all the other reports, and we want it to happen for only a specific container, not all containers/tables.

Can the talif:cli-compact-stats/tailf:cli-width help with this? And if not, is the only alternative to make significant custom formatting like in the former example? I hope there is a simpler way.

Thanks,

-Donald

Yes, if you want all leaf elements on a single line by using tailf:cli-suppress-table, tailf:cli-compact-stats, tailf:cli-wrap, and tailf:cli-width will wrap that line at the specified width.

The details for those extensions can be found in the tailf_yang_cli_extensions(5) man page.

Regards