How to set an option to false

Jan 6, 2014 at 11:43 AM
Unfortunately I have no glue how to set an option, that is set per "DefaultValue = true", to false.
[Option('e', "show-exceptions", DefaultValue = true, HelpText = "Show exceptions in a GUI dialog.")]
public bool ShowExceptions { get; set; }
Sep 1, 2014 at 11:35 AM
Hi,

I struggled with the same issue. IMO you have 3 options:
  1. Change the boolean option to have the opposite meaning (dont-show-exceptions in your case).
  2. Use a string property instead and compare against a "true"/"false" value (error prone).
  3. Change the source code by removing the !option.IsBoolean from Parsing/OptionGroupParser.cs (diff here: http://pastebin.com/vvFuNDW7). This will require that a value is passed for boolean properties just like any other property type.
Rgds
JCM