I’m currently working on a project which is using Cmdliner to deal with the command-line. I need to add a feature, but I don’t know if I have to handle it myself or, if the library is able to do it for me.
My goal is to add two options: a flag --mock and an option --power <string>. However, I don’t want these options to be used at the same time. I can handle it in the function given to Term.const but I was wondering if the library has a native mechanism to deal with it?
I don’t think it’s possible, what the API provides is mutually exclusive flags with vflag.
What you can have is a “last flag/option takes over” with last, during argument to term conversion. I wonder whether what you ask for could also be resolved at that level (I don’t know).
According to what you said, I can use a trick to handle it with last by using some type conversion. However, it seems to be easier to ensure it in the function as the flag and the option don’t have the same type.