CommandLineParser.Parse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Parse(Command, IReadOnlyList<String>, ParserConfiguration) |
解析一串論點。 |
| Parse(Command, String, ParserConfiguration) |
解析命令列字串。 |
Parse(Command, IReadOnlyList<String>, ParserConfiguration)
解析一串論點。
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
參數
- command
- Command
用來解析命令列輸入的指令。
- args
- IReadOnlyList<String>
字串陣列通常會傳遞給程式的方法 Main 。
- configuration
- ParserConfiguration
解析器文法與行為所依據的配置。
傳回
ParseResult A 提供關於解析操作的詳細資訊。
適用於
Parse(Command, String, ParserConfiguration)
解析命令列字串。
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
參數
- command
- Command
用來解析命令列輸入的指令。
- commandLine
- String
完整的命令列輸入,在拆分和分詞化之前。 當解析器從 Program.Main中呼叫時,通常無法取得此輸入。 它主要用於透過該 dotnet-suggest 工具計算完備度。
- configuration
- ParserConfiguration
解析器文法與行為所依據的配置。
傳回
ParseResult A 提供關於解析操作的詳細資訊。
備註
命令列的字串輸入會像在命令列中傳遞一樣被拆分成標記。