Command Line Parser Library - Boolean Parameter
bool?
behaves the way you want
with :
[Option('c', "closeWindow", Required = true, HelpText = "Close the window.")]
public bool? CloseWindow { get; set; }
the result will be :
-c false // -> false
-c true // -> true
-c // -> error
// -> error if Required = true, null otherwise
You don't need to add True
or False
. Using -c
will evaluate to True
. Not using it will evaluate to False
. Somewhere in the documentation there is an example with -v
for verbose output. But I can't find it right now. I guess Required=true
is not necessary for Boolean options.