-
-
Notifications
You must be signed in to change notification settings - Fork 263
Closed
Labels
Description
I'm using CommandLineUtils to parse command line options, but I don't want to use the library's execution engine, because I don't want to refactor the existing code to fit that model. So I'm using the Parse method like this:
var app = new CommandLineApplication(throwOnUnexpectedArg: false);
var configurationOption = app.Option<string>(
"-c|--configuration",
"The build configuration",
CommandOptionType.SingleValue,
option => option.Accepts(builder => builder.Values("Debug", "Release")));
app.Parse(args);
var configuration = configurationOption.HasValue() ? configurationOption.Value() : "Release";
However, option.Accepts(builder => builder.Values("Debug", "Release")) seems to have no effect. It looks like validation isn't run. Is this the expected behavior? If not, how could I achieve what I'm trying to do?
I know I could just check the value manually, but I was hoping to take advantage of CommandLineUtils' validation mechanism.