CommandManager.RunCommandAsync Method

Finds and instantiates the subcommand using the arguments from the GetCommandLineArgs() method, using the first argument as the command name. If it succeeds, runs the command asynchronously. If it fails, writes error and usage information.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.0.0
C#
public Task<int?> RunCommandAsync()

Return Value

Task<Nullable<Int32>>
A task representing the asynchronous run operation. The result is the value returned by RunAsync(), or null if the command could not be created.

Remarks

This function creates the command by invoking the CreateCommand(), method. If the command implements the IAsyncCommand interface, it invokes the RunAsync() method; otherwise, it invokes the Run() method on the command.

Exceptions

ArgumentNullExceptionargs is null
ArgumentOutOfRangeExceptionindex does not fall inside the bounds of args.

See Also