ShellCommandRunShellCommand Method (Assembly, String, String, Int32) |
Namespace: Ookii.CommandLine
public static int RunShellCommand( Assembly assembly, string? commandName, string[] args, int index )
Exception | Condition |
---|---|
ArgumentNullException | assembly or args is |
ArgumentOutOfRangeException | index does not fall inside the bounds of args. |
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.