CommandManagerRunCommand(String, ReadOnlyMemoryString) 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: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public int? RunCommand(
	string? commandName,
	ReadOnlyMemory<string> args
)

Parameters

commandName  String
The name of the command.
args  ReadOnlyMemoryString
The arguments to the command.

Return Value

NullableInt32
The value returned by ICommandRun, or if the command could not be created.

Remarks

This function creates the command by invoking the CreateCommand(String, ReadOnlyMemoryString) method, and then invokes the ICommandRun method on the command.

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

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

See Also