ConfD User Community

Is there a way to display a cli command param only when other conditions are met?

Giving these params in a .cli command:
..... <param> <name>typeA</name> <type> <simpleType namespace="" name="string"/> </type> </param> <param> <name>typeB</name> <param> <name>typeC</name> <type> <simpleType namespace="" name="string"/> </type> <optional/> </param> ....

Is there a way to ask user for typeC ONLY if typeA have specific value and “hiding” in other case? (optional is somewhat a way but not enough)
Something like the “when” statement in .yang
Thanks in advance.

I don’t think there is a way to do this conditional thing in the clispec.
Try to use a modeled action or rpc instead.


I believe you can use examples.confd/cli/completions as inspiration. Try the “setClock” CLI config command in that example as implemented by the “confd.cli” clispec.
(it uses a /clispec/$MODE/cmd/params/param/callback/capi/completionpoint)