The documentation for syntax-first method binding states that:
Parameters are matched using a naming convention that converts camel-cased parameters to kebab-cased options. In this example, the option --an-int matches parameter anInt on the DoSomething method.
However, it is not possible to have a command option named "--system-name" and bind it to a parameter string systemName
Adding some sample code the reproduces the issue:
```C#
var outer = new Command("outer");
outer.AddOption(new Option("--system-name", argument: new Argument
var inner = new Command("inner");
outer.AddCommand(inner);
inner.Handler = CommandHandler.Create((string systemName, ParseResult result) =>
{
string sName = result.RootCommandResult.ValueForOption
});
outer.Handler = CommandHandler.Create((string systemName, ParseResult result) =>
{
});
``
When invoked withouter.InvokeAsync("outer --system-name foo");thesystemNameparameter is appropriately passed. When invoking withouter.InvokeAsync("outer --system-name foo inner");thesystemNameis not passed, and you are forced to look it up from theParseResult`.
This is now fixed.