ConfD User Community

CLI - alternate list template


Assuming we have a list of interfaces such as:

list interface {
  tailf:info "Interface configuration";
  tailf:cli-show-template "Interface $(name) is $(state/oper-status)\nDescription is $(description)";
  key name;
  leaf name { ... }
  leaf description { ... }
  leaf shutdown { ... }
  leaf address { ... }
  container state {
    config false;
    tailf:info "Interface state";
    leaf oper-status { ... }

It’s easy to customize the output of CLI command show interface using tailf:cli-show-template.
But what’s the best way to implement a show interface brief command (or similar) that would apply to the same list but with another template?
I know I can register a custom command using clispec and generate the full output using MAAPI in the callback, but that’s far more complicated and doesn’t handle pagination if I’m not mistaken.

Thanks for the help!

You need to use the clispec and you can handle pagination.
See examples.confd/cli/show_brief/commands-c.cli for a clispec example that uses the paginate option.

Alright, thanks for the feedback.