Open
Description
Hi there,
thank you providing such a great library!
I've read through the issues section and came across #1012.
In my scenario, a complex class is used to create the handler. Is there currently any way to redirect an option or argument to a property of the complex class not matched by name?
I can't use the other binding approach, as I use a generic method (AddItem) to handle the bound complex types.
Example
public class ComplexType
{
public string SomeId { get; set; }
...
}
...
complexTypeCommand.AddOption(new Option<string>(new string[] { "--some" }, () => default, "Binding assigns value to SomeId."));
complexTypeCommand.Handler = CommandHandler.Create<ComplexType>(AddItem);
As an idea it might be possible to introduce an additional parameter to AddOption or AddArgument to express an explicit binding.
Example
complexTypeCommand.AddOption(new Option<string>(new string[] { "--some" }, () => default, "Binding assigns value to SomeId."), propertyToBind: nameof(ComplexType.SomeId));
Metadata
Metadata
Assignees
Labels
No labels