commandlineparser / commandlineparser/commandline
Make the Error class more useful
- 主要語言
- C#
- 星號
- 4.8k
- 分支
- 478
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Consider the following code:
```cs
parserResult.MapResult(
options => 0,
errs =>
{
foreach (var error in errors)
{
Console.Error(error); //right now this will just print out the Error type
}
return 1;
});
```
Right now building the error string is a manual process of checking the type, casting to the correct subclass, etc. Fortunately that logic already exists here:
https://github.com/commandlineparser/commandline/blob/7aa501d534a657c388f94f66127b4f8dde64ac59/src/CommandLine/Text/SentenceBuilder.cs#L110
All we have to do is put it in `Error.ToString()`...
Another useful addition would be something like `HelpText.AddError(Error)` / `HelpText.AddErrors(Ienumerable)` .
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 src/CommandLine/Text/SentenceBuilder.cs 中所參照的錯誤格式化邏輯開始,然後檢查 Error 和 HelpText 類別。讓 Error.ToString() 顯露現有的格式化錯誤文字,並評估所提議的 HelpText.AddError/Error 集合輔助方法;完成的標準是無需手動型別檢查即可實用地列印錯誤。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100