commandlineparser / commandlineparser/commandline
Question - can f# matching handle verbs?
- 主要語言
- C#
- 星號
- 4.8k
- 分支
- 478
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Sorry for question as issue, googled a bit and had no luck.
Is the F# matching support meant to work with verbs? I'm trying
```fs
[]
type UploadOptions = {
[] FileName: string;
[] RootUrl: string;
}
[]
type OtherOptions = {
[] Opt: string;
}
let getOpts argv : CLIOptions =
let result = CommandLine.Parser.Default.ParseArguments(argv)
match result with
| :? Parsed as p -> p.Value // <-- compile error here
| :? Parsed as p -> p.Value
| :? NotParsed as e ->
let errs = e.Errors |> Seq.map string |> Seq.toList
failwith <| String.Join("\n", errs)
| _ -> failwith "bang"
```
But this fails to compile:
```
Type constraint mismatch. The type
'Parsed'
is not compatible with type
'ParserResult'
```
I don't have a good understanding of how C# types map to F# sorry, so apologies if I'm missing something obvious.
EDIT: Never mind, found the readme. Consider this a feature request to not need to double match against `obj`. :)
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 README 中關於 F# 支援的指引以及 issue 中展示的 ParserResult、Parsed 和 NotParsed 型別開始。確定如何向 F# 呼叫方公開特定於 verb 的結果;當呼叫方可以對已剖析命令的結果進行比對,而不必針對 obj 進行兩次比對時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100