commandlineparser / commandlineparser/commandline

Converting from 1.9.71 to 2.9.1, having issues.

オープン
#846 コメント 0 件 リアクション 0 件 担当者 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 で参照されているコマンドラインオプションの検証とヘルプ生成に関するドキュメントを確認し、次にオプショングループ、セット、数値制約、ヘルプ出力の現在の処理を追跡してください。完了時点で、要求された2つの動作がサポートされているかどうかを明らかにし、それらのための明確な対応方針を文書化または実装している状態にしてください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
cli
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。