Exemplo n.º 1
0
        public static int Run(IHost host, InvocationContext context, IHelpBuilder help)
        {
            var log = host.Services.GetRequiredService <ILogger <MainCommand> >();

            log.LogDebug("Run main");

            help.Write(context.ParseResult.CommandResult.Command);

            return(ExitCodes.Success);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get help builder interface
        /// </summary>
        /// <param name="helpBuilder">help builder</param>
        public Task InvokeAsync(IHelpBuilder helpBuilder)
        {
            Command command = CommandProcessor.GetCommand(Command);

            if (command != null)
            {
                helpBuilder.Write(command);
            }
            else
            {
                Console.Error.WriteLine($"Help for {Command} not found.");
            }
            return(Task.CompletedTask);
        }
 /// <summary>
 /// Writes help output for the specified command.
 /// </summary>
 /// <param name="builder">The help builder to write with.</param>
 /// <param name="command">The command for which to write help output.</param>
 /// <param name="writer">The writer to write output to.</param>
 public static void Write(
     this IHelpBuilder builder,
     ICommand command,
     TextWriter writer) =>
 builder.Write(command, writer, ParseResult.Empty());