-
Improved: Added new class
CliRunnableResultwhich derives fromCliResultand addsRunandRunAsyncmethods
running the handler for the called command.
Changed return type ofCli.ParseandCliParser.Parsemethods fromCliResulttoCliRunnableResult
So now you can do:var result = Cli.Parse<RootCliCommand>(); return result.Run(); //or var parser = Cli.GetParser<RootCliCommand>(); var result = parser.Parse(args); return result.Run();
-
Changed: Deprecated
CliContext.IsEmptyCommand()andCliContext.IsEmpty(), use new properties
!CliContext.Result.HasArgsand!CliContext.Result.HasTokensinstead.
These are better suited to be inCliResultand naming should better clarify the purpose. -
Fixed:
QualifiedSyntaxRewriterto support fully qualify generic name syntax likeArray.Empty<CustomClass>().
Changed handling so thatIdentifierNameSyntaxanywhere is converted to fully qualified. -
Fixed: Calling
Cli.Ext.ConfigureServiceswill reset existing service provider if it was already built or set,
so that changed service collection can take effect:var result = Cli.Parse<IStartupOptions>(args); var startupOptions = result.Bind<IStartupOptions>(); //This works now, the existing service builder (caused by Cli.Parse) will be reset Cli.Ext.ConfigureServices(services => { services.AddSingleton(startupOptions); services.AddSingleton<Dependency>(); }); await Cli.RunAsync<RootCommand>(args);