CommandManager.RunCommand(String, String[], Int32) Method

Finds and instantiates the subcommand with the specified name, and if it succeeds, runs it. If it fails, writes error and usage information.

Definition

Namespace: Ookii.CommandLine.Commands
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
C#
public int? RunCommand(
	string? commandName,
	string[] args,
	int index
)

Parameters

commandName  String
The name of the command.
args  String[]
The arguments to the command.
index  Int32
The index in args at which to start parsing the arguments.

Return Value

Nullable<Int32>
The value returned by Run(), or null if the command could not be created.

Remarks

This function creates the command by invoking the CreateCommand(String, String[], Int32), method and then invokes the Run() method on the command.

Exceptions

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

See Also