commandlineparser / commandlineparser/commandline

Detecting switches

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

説明

I am getting confused here:

```
public class Options
{
[Option('c', "create", Required = false, HelpText = "Creates an empty CSV. Eg: -c \".\\File.csv\"")]
public string EmptyCsvFilePath { get; set; }
[Option('x', "clm", Required = false, HelpText = "Import history from CLM Explorer. Eg: -x \".\\File.csv\"")]
public string ClmExplorerHistoryPath { get; set; }
[Option('h', "hist", Required = false, HelpText = "Import generic history. Eg: -h \".\\File.csv\"")]
public string GenericHistoryPath { get; set; }
}
```

All these switched are optional. But, if the switch is used then the values must be provided.

How do I handle this? At the moment the paths are null if either the switch is not provided or no path is provided. But it is only an issue if the switch was provided and no path.

if a switch is provided, it should have a value.

Using latest stable release.

Please help me. Thanks.

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

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

調査の方向性

ソースファイル、テスト、エントリポイントのいずれも特定されていません。まず、文字列値を取るオプションのスイッチについて、オプション解析と検証の動作を特定し、次に、省略されたスイッチは有効なままであり、値なしで指定されたスイッチは拒否されることを確認してください。

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

評価

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

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

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