We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug A boolean property parsed incorrectly, at the same time nullable boolean property - ok!
To Reproduce https://dotnetfiddle.net/fwRMdJ
class Options { [Option('a', "option1", Required = true)] public bool Option1 { get; set; } [Option('b', "option2", Required = false)] public bool? Option2 { get; set; } } class Program { static int Main(string[] args) { args = "--option1 false --option2 false".Split(' '); return Parser.Default.ParseArguments<Options>(args) .MapResult( options => RunAndReturnExitCode(options), _ => -1); } static int RunAndReturnExitCode(Options options) { Console.WriteLine($"option1={options.Option1}, option2={options.Option2}"); return 0; } }
option1=True, option2=False
Expected behavior option1=False, option2=False
The text was updated successfully, but these errors were encountered:
Same root problem as I'm having?
#783 (comment)
You have a boolean option default=true. Does CommandLineParser not support setting booleans to false?
If you change option2 to default = true and run with --option2 false do you still get the same result?
--option2 false
Sorry, something went wrong.
No branches or pull requests
Describe the bug
A boolean property parsed incorrectly, at the same time nullable boolean property - ok!
To Reproduce
https://dotnetfiddle.net/fwRMdJ
option1=True, option2=False
Expected behavior
option1=False, option2=False
The text was updated successfully, but these errors were encountered: