commandlineparser / commandlineparser/commandline
Default verb treated as a value.
- 主要言語
- C#
- スター
- 4.8k
- フォーク
- 478
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
This was seen on version 2.8.0 targeting .NET Core 3.1 / 5.
Minimum code sample:
```
void Main()
{
var parser = new Parser();
var result = parser.ParseArguments(new[] { "copy", @"A:\", @"C:\", });
result
.WithParsed(a =>
{
Console.WriteLine(a.SourcePath);
Console.WriteLine(a.DestinationPath);
});
}
[Verb("copy", isDefault: true)]
class CopyArguments
{
[Value(0, MetaName = "source", Required = true)]
public string? SourcePath { get; set; }
[Value(1, MetaName = "destination", Required = true)]
public string? DestinationPath { get; set; }
}
````
This prints "copy" for `SourcePath` and "A:\\" for `DestinationPath`.
At this point in development I only have one verb (more verbs are planned), and that verb is/will be the default one.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、示されている [Verb] 属性と [Value] 属性を使い、Parser.ParseArguments を通してサンプルを再現します。位置値が割り当てられる前に既定の verb がどのように処理されるかを追跡し、その後、引数から既定の verb を省略した場合に SourcePath が A:\\ を受け取り、DestinationPath が C:\\ を受け取ることを証明する回帰テストを追加または更新します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100