I'm enjoying using this library, despite it still being in the experimental stages, but I'm not sure how to deal with the latest changes.
Specifically, when bumping System.CommandLine.Experimental from 63807-01 to 63822-01, it no longer binds a nullable int parameter and it always gets passed as 0, even though I specify it should default to a value. See the full source at BoardGameGeek.Dungeon/Application/CommandLine.cs.
If I change the year option to:
c#
var yearOption = new Option(new[] { "-y", "--year" }, "Year to analyze.", new Argument<int?>());
I'd expect it to bind to null if not specified on the command-line, or the value if specified, but it still always gets passed as 0 in both cases, so the binding no longer works at all.
It does work again if I replace int? everywhere with int; but this used to work, albeit with no guarantees of stability, and it seems reasonable to want to bind to a nullable value type.
Thanks. This is a bug introduced by the latest binding refactor (which added support for binding to complex types, e.g. `CommandHandler.Create
This should be fixed now with #419.
Wow, confirmed as fixed! Thanks a lot, @jonsequitur!