commandlineparser / commandlineparser/commandline

How to add constraints to an int option?

オープン
#905 コメント 1 件 リアクション 6 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
4.8k
フォーク
478
PR マージ指標
30日以内にマージされた PR はありません

説明

Is it possible to set constraints to an int option so that it have min and max allowed values? I think that's a pretty common scenario, but the following fails:

```csharp
[Option('q', "quality", Default = 80, Min = 1, Max = 100)]
public int Quality { get; set; }

```
With this exception: `System.InvalidOperationException: Scalar option specifications do not support range specification.`

If the library does not provide this functionality how would I implement it on my own and still play nicely with the auto help and error messages that the library automatically outputs on invalid input?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

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

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