clicon / cligen

CLIgen is a Command-Line Interface generator
http://www.cligen.se
Other
33 stars 37 forks source link

Conditional CLI #104

Closed Dorababupc closed 9 months ago

Dorababupc commented 9 months ago

Hello guys, I am using CLIGEN for one of my projects and I have come across a situation. Let me explain with an example. My ideal cli would look like below:

    interface ethernet port-channel [ fast-rate ] [ min-links]

Now, I want to make it :

  interface ethernet port-channel [ min-links] 

so that user cannot get prompt for fast-rate if some condition is not met. And display as it is if the condition is met. Is there a way to do it in cligen ?

I guess I can make this by changing the treename depending upon the condition. But I want to have both of them within the same tree.

Thank you for your time.

olofhagsand commented 9 months ago

You mean a runtime/dynamic condition affecting which syntax is present? No, there is no such mechanism. I guess it could be implemented via some kind of callback.

Dorababupc commented 9 months ago

okay got it. Thank you for your timely response.

Closing this issue.