-
I have the following option: [CommandOption("list-terms", Description = "Test")]
public string? ListTerms { get; set; } There are three variations of the command line:
Here is the behavior I want to program for each of the variations above:
Right now, 1 & 2 are ambiguous. In other words, I get the same value in the I need a way to require that an option be given an explicit value, but not require the option itself. Is this possible right now? I'm OK implementing the enforcement myself, but that still requires me to disambiguate 1 & 2 above by using the value of the property after command line processing is done by CliFx. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I think you can do it via [CommandOption("list-terms", Description = "Test", Validators = new[] { typeof(MyValidator)})] If I remember correctly, the validator is only triggered on the value if the option has been provided, so you would simply handle the |
Beta Was this translation helpful? Give feedback.
I think you can do it via
BindingValidator
and by setting the validator on theCommandOption
:If I remember correctly, the validator is only triggered on the value if the option has been provided, so you would simply handle the
null
value which would correspond to case 2 in your situation.