Open
Description
I spent a while trying to figure out why my options were not binding, even though I was doing everything the docs said to.
However, I was doing essentially what the docs said.
static async Task Main(string[] args)
{
var rootCommand = new RootCommand
{
new Option
(
name: "--target",
argumentType: typeof(string),
arity: ArgumentArity.ExactlyOne
)
};
rootCommand.Handler = CommandHandler.Create<string>(Foo);
await rootCommand.InvokeAsync(args);
}
private static int Foo(string targetAssembly) // <-- mistake!
{
Console.WriteLine($"--target = {targetAssembly}");
}
My mistake was just in the name of the parameter, and I didn't see this mentioned in the docs anywhere. I would like to suggest adding it to the first section of the "Model bindings" page :)
This other issue is how I figured out my problem, FWIW: #1326
Metadata
Metadata
Assignees
Labels
No labels