CommandLineParser.Parse Method

Definition

Overloads

Parse(Command, IReadOnlyList<String>, ParserConfiguration)

Source:
CommandLineParser.cs

Parses a list of arguments.

public static System.CommandLine.ParseResult Parse(System.CommandLine.Command command, System.Collections.Generic.IReadOnlyList<string> args, System.CommandLine.ParserConfiguration? configuration = default);
static member Parse : System.CommandLine.Command * System.Collections.Generic.IReadOnlyList<string> * System.CommandLine.ParserConfiguration -> System.CommandLine.ParseResult
Public Shared Function Parse (command As Command, args As IReadOnlyList(Of String), Optional configuration As ParserConfiguration = Nothing) As ParseResult

Parameters

command
Command

The command to use to parse the command line input.

args
IReadOnlyList<String>

The string array typically passed to a program's Main method.

configuration
ParserConfiguration

The configuration on which the parser's grammar and behaviors are based.

Returns

A ParseResult providing details about the parse operation.

Applies to

Parse(Command, String, ParserConfiguration)

Source:
CommandLineParser.cs

Parses a command line string.

public static System.CommandLine.ParseResult Parse(System.CommandLine.Command command, string commandLine, System.CommandLine.ParserConfiguration? configuration = default);
static member Parse : System.CommandLine.Command * string * System.CommandLine.ParserConfiguration -> System.CommandLine.ParseResult
Public Shared Function Parse (command As Command, commandLine As String, Optional configuration As ParserConfiguration = Nothing) As ParseResult

Parameters

command
Command

The command to use to parse the command line input.

commandLine
String

The complete command line input prior to splitting and tokenization. This input is not typically available when the parser is called from Program.Main. It is primarily used when calculating completions via the dotnet-suggest tool.

configuration
ParserConfiguration

The configuration on which the parser's grammar and behaviors are based.

Returns

A ParseResult providing details about the parse operation.

Remarks

The command line string input will be split into tokens as if it had been passed on the command line.

Applies to