commandlineparser / commandlineparser/commandline
Values are not set properly wit multiple bool arguments
- 主要語言
- C#
- 星號
- 4.8k
- 分支
- 478
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I am passing 2 bool options, one on true and the other on false
But after being convert to the class all are true;
static void Main(string[] args)
{
args = new[] {"-p 88", "-t true", "-s false"};
var parseResult = Parser.Default.ParseArguments(args)
.WithParsed(o =>
{
Console.WriteLine($"PartnerId: -p {o.PartnerId}");
Console.WriteLine($"Test: -t {o.Test.ToString().ToLower()}");
Console.WriteLine($"SuppressEmail: -s {o.SuppressEmail.ToString().ToLower()}");
}
);
}
}
public class Options
{
[Option('p', "partnerId", Required = true, HelpText = "p = PartnerId")]
public int PartnerId { get; set; }
[Option('t', "test", HelpText = "Allows the app to be run on test mode, using only the allowed accounts")]
public bool Test { get; set; }
[Option('s', "suppressEmail", HelpText = "The app will not send the email to Post Up")]
public bool SuppressEmail { get; set; }
}
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
使用 Parser.Default.ParseArguments(args) 和報告中顯示的 Options 類別,傳入 -t true 和 -s false 來重現問題。先追蹤 parser 如何處理 bool 引數,然後確認解析出的 Test 和 SuppressEmail 值是否與提供的引數一致。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100