I'm currently initializing my options object using a custom factory (i.e. ParseArguments(factory, args)). I also am not using any explicit default values in the Option attributes.
When the args contain a default value (e.g. false for an boolean option), ParseArguments doesn't override the matching property value, however it leaves it as the value initialized by the factory.
Is there any way to "force" ParseArguments to override the property value in this case?
Example code snippet:
// Override initialized value with default value
var myArgs = new string[] { "--recover", "false" };
ParserResult<Options> result = parser.ParseArguments(() => new Options
{
Recover = true
}, myArgs);
var cmdLineOptions = result.MapResult(o => o, xs => new Options());
Assert.AreEqual(false, cmdLineOptions.Recover); // This fails
Hi all,
I'm currently initializing my options object using a custom factory (i.e. ParseArguments(factory, args)). I also am not using any explicit default values in the Option attributes. When the args contain a default value (e.g. false for an boolean option), ParseArguments doesn't override the matching property value, however it leaves it as the value initialized by the factory. Is there any way to "force" ParseArguments to override the property value in this case?
Example code snippet:
Appreciate your help!
Tal.