Ejemplo n.º 1
0
        public static Task <int> Main(string[] args)
        {
            var definition = new RootCommandDefinition(RootCommandHandler);

            return(DefaultCommandLine.InvokeAsync(definition, args, host =>
            {
            }));
        }
Ejemplo n.º 2
0
        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));
        }