Make GetValueForHandlerParameter public
If we are now required to write extension methods to allow for injected parameters (from beta 4), and get the values for the IValueDescriptors, having GetValueForHandlerParameter to be public, or an extension method would be useful. At this stage I am copying in the implementation into each project to facilitate this.
https://github.com/dotnet/command-line-api/blob/eaad2347f04f6a467d0ac02793bc4ed1d64889ca/src/System.CommandLine/Handler.cs#L11
If the problem you're trying to solve is specific to dependency injection, another option is the one described here: https://github.com/dotnet/command-line-api/issues/1750#issuecomment-1152707726
Any thoughts on this approach?
I was using something like that to get IHost, but was using context.Console, and context.GetCancellationToken() to get the IConsole and CancellationToken, which is not available directly from using the BindingBase<>.
It appears that we could use that to the IConsole, but how would we get the CancellationToken?
Bind.FromServiceProvider<CancellationToken>() and Bind.FromServiceProvider<IConsole>() should work.