Skip to content

Change in parsing behaviour between 6 and beta7 #2620

@barrygiles

Description

@barrygiles

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions