ConfD User Community

Is there any way to stop showing leaf-list in possible completion


#1

I have an action in yang, and inside it, I have a leaf-list, for example:

container testLeaflistAction {
tailf:action testAction {
tailf:actionpoint test-action;
input {
leaf-list elements {
tailf:info “elements”;
type string;
}
The leaf-list should have multiple elements, so not consider min-elements or max-elements.
When user type "request action testAction elements [ … ] ", and then they press tab, still have leaf-list elements in the possible completion list in terminal. Is there any way to fix that, so after first time user tab elements leaf-list, then tab again, then there’s no leaf-list in possible completion any more.


#2

I am not sure I understand what behaviour you want from the tab complete here. Some example would be helpful I believe.

But one way to customize the tab completion is to for example use the “tailf:cli-completion-actionpoint” extension. See the tailf_yang_cli_extensions(5) man page for more details.

For some example implementations, see
examples.confd/cli/climods
examples.confd/linuxcfg/ietf_interfaces and examples.confd/linuxcfg/ietf_system


#3

Hi Conhult, thank you for your reply.
for example, I have an action like:
container testLeaflistAction {
tailf:action testAction {
tailf:actionpoint test-action;
input {
leaf-list elements {
tailf:info “elements”;
type string;
}
In terminal I type “request action testAction”, then I press “tab”, the possible completion will showing up in terminal that have elements which type is leaf-list, then I choose “elements” from the possible completion, then I give elements [ value1, value2 ], then if I press “tab” again, in possible completion will still have elements.
To fix that, I can set min-elements and max-elements of leaf-list “elements” to 1, then fix,
but now in my case, I need more that one elements in leaf-list, I cannot do that.
And also for tailf:cli-completion-actionpoint", if I set it into leaf-list elements, it allowed, but it will controlled the “possible completion” inside leaf-list not the action input “possible completion”.
So I need to put tailf:cli-completion-actionpoint in the action testAction, but after I check the document, the tailf:cli-completion-actionpoint only work for leaf, leaf-list, etc, for action, there’s no way to use that.
my question is how to access the “possible completion” of tailf:action input. Can you give me an example, thank you.