Click or drag to resize

ShellCommandCreateShellCommand Method (Assembly, String, String, Int32)

Finds and instantiates the shell command with the specified name, or if that fails, writes error and usage information to the standard error and output streams.

Namespace:  Ookii.CommandLine
Assembly:  Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 2.3.0
Syntax
public static ShellCommand CreateShellCommand(
	Assembly assembly,
	string commandName,
	string[] args,
	int index
)

Parameters

assembly
Type: System.ReflectionAssembly
The assembly to search for the shell command.
commandName
Type: SystemString
The name of the command.
args
Type: SystemString
The arguments to the shell command.
index
Type: SystemInt32
The index in args at which to start parsing the arguments.

Return Value

Type: ShellCommand
An instance a class deriving from ShellCommand, or if the command was not found or an error occurred parsing the arguments.
Exceptions
ExceptionCondition
ArgumentNullExceptionassembly or args is
ArgumentOutOfRangeExceptionindex does not fall inside the bounds of args.
Remarks

If the command could not be found, a list of possible commands is written to the standard output stream. If an error occurs parsing the command's arguments, the error message is written to the standard error stream, and the shell command's usage information is written to the standard output stream.

Line wrapping at word boundaries is applied to the output, wrapping at the console's window width. When the console output is redirected to a file, Microsoft .Net will still report the console's actual window width, but on Mono the value of the WindowWidth property will be 0. In that case, the usage information will not be wrapped.

This method indents additional lines for the usage syntax, argument descriptions and command descriptions, unless the WindowWidth property is less than 31.

See Also