CliParseTDefinition(String, CliSettings) Method

Parses a command line string array and returns the parse result.

Definition

Namespace: DotMake.CommandLine
Assembly: DotMake.CommandLine (in DotMake.CommandLine.dll) Version: 1.8.7
C#
public static ParseResult Parse<TDefinition>(
	string[] args = null,
	CliSettings settings = null
)

Parameters

args  String  (Optional)
The string array typically passed to a program. This is usually the special variable args available in Program.cs (new style with top-level statements) or the string array passed to the program's Main method (old style). If not specified or , args will be retrieved automatically from the current process via GetArgs.
settings  CliSettings  (Optional)
The settings for the parser's grammar and behaviors.

Type Parameters

TDefinition
The definition class for the command. A command builder for this class should be automatically generated by the source generator.

Return Value

ParseResult
A ParseResult providing details about the parse operation.

Example

C#
//If you need to examine the parse result, such as errors:
var parseResult = Cli.Parse<RootCliCommand>(args);
if (parseResult.Errors.Count > 0)
{

}

See Also