commandlineparser / commandlineparser/commandline
Proposal for handling multiple mutual exclusive sets
- 主要言語
- C#
- スター
- 4.8k
- フォーク
- 478
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
As probably already discussed in #79 and #93 I would need to specify multiple mutual exclusive sets.
I would suggest to distinguish between multiple sets at an interface level.
For example I have a command that requires either a workspace name or a path to a workspace. The same command expects a connection name or user-host combination:
```csharp
interface IWorkspaceOptions
{
[Option(Required = true, SetName = "fromName")]
string WorkspaceName { get; set; }
[Option(Required = true, SetName = "Path")]
string FromPath { get; set; }
}
interface IConnectionOptions
{
[Option(Required = true, SetName = "fromName")] // not in the same set as IWorkspaceOptions !
string ConnectionName { get; set; }
[Option(Required = true, SetName = "Params")]
string Host { get; set; }
[Option(SetName = "Params")]
string User { get; set; }
}
class Opts : IWorkspaceOptions, IConnectionOptions
{
public string ConnectionName { get; set; }
public string Host { get; set; }
public string User { get; set; }
public string WorkspaceName { get; set; }
public string FromPath { get; set; }
}
```
I would expect the following command lines to be valid:
```
--WorkspaceName MyWorkspace --ConnectionName MyConnection
--WorkspaceName MyWorkspace --Host 1.2.3.4
--WorkspaceName MyWorkspace --Host 1.2.3.4 --User Foo
--FromPath C:\TMP --ConnectionName MyConnection
--FromPath C:\TMP --Host 1.2.3.4
--FromPath C:\TMP --Host 1.2.3.4 --User Foo
```
and the following invalid:
```--WorkspaceName MyWorkspace```
> Missing required connection options
```--ConnectionName MyConnection```
> Missing workspace options
```--WorkspaceName MyWorkspace --ConnectionName MyConnection --User Foo```
> Invalid mixture of mutual exclusive connection options
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
ソースファイル、テスト、エントリポイントは指定されていません。まず、Option SetName と相互排他の既存の処理を見つけ、次に、この issue に記載されたインターフェース例およびコマンドラインとその動作を比較してください。完了の条件は、インターフェースごとに独立した排他的セットをサポートし、記載された有効および無効な結果を生成することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- cli
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100