public static Task <int> Main(string[] args) { var definition = new RootCommandDefinition(RootCommandHandler); return(DefaultCommandLine.InvokeAsync(definition, args, host => { })); }
public static Task <int> Main(string[] args) { var handler = CommandHandler.Create( async(IHost host, CancellationToken cancelToken) => { var serviceProvider = host.Services; using var scope = serviceProvider.CreateScope(); var scopeProvider = scope.ServiceProvider; var executor = scopeProvider.GetRequiredService <CommandExecutor>(); await executor.ExecuteAsync(cancelToken).ConfigureAwait(false); }); var definition = new CommandDefinition(handler); return(DefaultCommandLine .InvokeAsync(definition, args, ConfigureHost)); }