commandlineparser / commandlineparser/commandline

Converting from 1.9.71 to 2.9.1, having issues.

未關閉
#846 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

Hello. I am attempting to upgrade my commandlineparser code to the latest version and I am struggling.

The program's requirements are pretty simple: must have one and only one parameter, with a choice between two options.

Here is what I would ultimately like to have:

[Option("daysback", Required = false, Group = "onerequired", SetName = "daysback", Min = 0, Max = 999, HelpText = "Number of days back in time for run date.")]
public int? DaysBack { get; set; }

[Option("date", Required = false, Group = "onerequired", SetName = "date", HelpText = "Specific date for run date (yyyymmdd).")]
public string RunDate { get; set; }

Group would require at least one parameter, setname would make them mutually exclusive, max and min would check a value.

Unfortunately (according to docs), group and setname cannot be used together, so I had to drop group. And, min/max cannot be used on an int argument, so also dropped.

So now we look like this:

[Option("daysback", Required = false, SetName = "daysback", HelpText = "Number of days back in time for run date.")]
public int? DaysBack { get; set; }

[Option("date", Required = false, SetName = "date", HelpText = "Specific date for run date (yyyymmdd).")]
public string RunDate { get; set; }

Which is okay, but means that I have more checking to do myself.

Two questions please:

1. As is, this will parse cleanly if no arguments are given. Is there a way to set max/min number of required arguments?
2. Is there a way to generate the help screen text on demand? If I find argument errors with my post-parse checking, I'd like to output the same help screen that commandlineparser does.

Thanks.

Bryan Hunt

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

未指定任何檔案或測試。先檢查 issue 中參照的命令列選項驗證與說明文件產生文件,然後追蹤目前對選項群組、集合、數值限制和說明輸出的處理;完成後應確認所要求的兩種行為是否受到支援,並為它們記錄或實作一條清楚的路徑。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。