Skip to content

Integrate ParserConfig into IParseValidator #52

@nemec

Description

@nemec

When building error messages during validation it may be helpful to refer to arguments by name in order to explain why parsing failed. Example:

Cannot use both -d/--delete and --move at the same time.

We already have the ability to refer to a strongly-typed name and value (e.g. nameof(opt.Delete) and opt.Delete), but the flags must be hardcoded. If we could pull them from the config, whenever it changes the validation message would automatically match.

Some notes:

  • Need the ability to access sub-config of verbs
  • Need to retrieve both the short and long names of a NamedArgument
  • Need to retrieve the meta name of a PositionalArgument
  • We might want to provide a facade over the complexity of IParserConfig and the IArguments and let users retrieve by name/namespace (e.g. config.GetArgumentFlags<Options>(opt => opt.Delete) == "-d/--delete"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions