CommandManager.RunCommand(String[]) Method

Finds and instantiates the subcommand with the name from the first argument, 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: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public int? RunCommand(
	string[] args
)

Parameters

args  String[]
The command line arguments, where the first argument is the command name and the remaining ones are arguments for the command.

Return Value

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

Remarks

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

Commands that don't meet the criteria of the CommandOptions.CommandFilter predicate are not included.

If the CommandOptions.ParentCommand is null, only commands without a ParentCommandAttribute attribute are included. If it is not null, only commands where the type specified using the ParentCommandAttribute attribute matches the value of the property are included.

Exceptions

See Also