Integrate ParserConfig into IParseValidator
nemec opened this issue · comments
Nemec commented
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"