Description
TLDR; I'd like to use attributes to do commandline parameter to complex class property name mapping.
I just ran into the problem of too many parameters in command handler functions.
I found the complex object mapping proposed solution where I pass a config class with matching properties to the command handler.
Now I'm stuck using property names that match command attribute names, i.e. I want the commandline attributes to be concise, but I want my class naming to be descriptive.
Is it possible or planned to use attributes on the property names for matching, similar to e.g. JSON where the attribute describes the JSON node and the class code can be whatever?
I've used this method in other commandline mapping classes, but I'd like to standardize on this version as it seems to have a good chance of becoming a standard.
See: https://github.com/commandlineparser/commandline
E.g.
public class CommandLineOptions
{
[CommandLineProperty("settings")]
public string FooBarSettingsFile { get; set; } = "foo.json";
// Other attributes
}
// ...
Handler = CommandHandler.Create<CommandLineOptions>(PrintInfoCommand);
Using attributes could also allow for defining parse handling, e.g. default value handling, required, optional, etc.
Is this supported, or is there an alternative easy way to instruct the parser which class properties to map to which commandline attributes?