The entry point for a command line application with a default command.
Constructors
public CommandApp`1(ITypeRegistrar registrar = null)
Initializes a new instance of the CommandApp class.
Parameters:
registrar (ITypeRegistrar)Methods
public void Configure(Action<IConfigurator> configuration)
Configures the command line application.
Parameters:
configuration (Action<IConfigurator>)public int Run(IEnumerable<string> args, CancellationToken cancellationToken = default)
Runs the command line application with specified arguments.
Parameters:
args (IEnumerable<string>)cancellationToken (CancellationToken)CancellationToken that can be used to abort the application.Returns:
The exit code from the executed command.
public Task<int> RunAsync(IEnumerable<string> args, CancellationToken cancellationToken = default)
Runs the command line application with specified arguments.
Parameters:
args (IEnumerable<string>)cancellationToken (CancellationToken)CancellationToken that can be used to abort the application.Returns:
The exit code from the executed command.
public CommandApp<TDefaultCommand> WithData(object data)
Sets data that will be passed to the command via the CommandContext.
Parameters:
data (object)Returns:
The same CommandApp instance so that multiple calls can be chained.
public CommandApp<TDefaultCommand> WithDescription(string description)
Sets the description of the default command.
Parameters:
description (string)Returns:
The same CommandApp instance so that multiple calls can be chained.