ConfD User Community

Change show order in cli

I’m using tailf:sort-priority inside a list to change how items are shown in CLI, but seems like it doesn’t change the position of the key item, wich is always the first.
Example:

list myList {
    key myLeaf3;

    leaf myLeaf1{
        tailf:sort-priority 0;
    }

    leaf myLeaf2{
        tailf:sort-priority 1;
    }

    leaf myLeaf3{
        tailf:sort-priority 2;
    }
}

Expected output order on show in CLI:
myLeaf1 myLeaf2 myLeaf3

Output order I get on show in CLI:
myLeaf3 myLeaf1 myLeaf2

If I change wich leaf is the key, it goes to the first position no matter what priority is set to it.

Have a look at tailf:cli-prefix-key, I think it is doing what you are up to.

Thanks for your reply!
Tried this:

list myList {
    key myLeaf3;

    leaf myLeaf1{
        tailf:sort-priority 0;
        tailf:cli-prefix-key;
    }

    leaf myLeaf2{
        tailf:sort-priority 1;
    }

    leaf myLeaf3{
        tailf:sort-priority 2;
    }
}

But it doesn’t change anything. Also tried inserting tailf:cli-before-key substatement, without success.

Have you tried something like:

list myList {
  key myLeaf3;
  leaf myLeaf1 {
    type string;
    tailf:cli-prefix-key;
  }
  leaf myLeaf2 {
    type string;
    tailf:cli-prefix-key;
  }
  leaf myLeaf3 {
    type string;
    tailf:cli-expose-key-name;
  }
}