-
Notifications
You must be signed in to change notification settings - Fork 418
Description
I'm trying to understand the change in behaviour I'm seeing around parsing with the move from beta6 to beta7.
Specific library changes:
from 2.0.0-beta6.25351.105
to 2.0.0-beta7.25353.2
The issue I'm seeing seems like it's related to boolean values, but might not be limited to those.
It seems like on the earlier version, boolean options would show as having a default value if the DefaultValueFactory was set. This seems to have changed now, so that when I inspect the parse result, it looks like all boolean values have been set with a default, which seems less helpful to me. It gives the impression that these values have been set somehow, either through the command line or with an explicit default value.
e.g. for the command: mycommand subcommand --verbose
where --no-color has DefaultValueFactory set
Before: Parse result: [ mycommand [ subcommand [ --verbose ] *[ --no-color ] ]
After: Parse result: [ mycommand [ subcommand [ --verbose ] *[ --quiet ] *[ --no-interactive ] *[ --no-color ] ]
I had an extension method for checking whether an option is set, which I was using to see if both --quiet and --verbose were set, which is now not working properly.
public static Boolean HasOption(this SymbolResult symbolResult, Option option) =>
symbolResult.GetResult(option) is not null || option.HasDefaultValue;
Is this a bug? And if not, could someone help explain the change in behaviour please?