commandlineparser / commandlineparser/commandline
How to pass and retain subsequent arguments to a verb with exact format?
- 主要语言
- C#
- 星标
- 4.8k
- 派生
- 478
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am trying to create a verb that includes all subsequent arguments. I require it to retain the exact format in which it is passed to the verb. My intention is to forward the arguments as a shell command. I have tried the following configuration:
```csharp
[Verb("foreach")]
public readonly struct ForeachVerb
{
[Value(0)]
public IEnumerable Command { get; set; }
}
```
But unfortunately, I am encountering errors indicating that options `f`, `foo`, and `bar` are missing for this test argument:
foreach foo bar baz -f true --foo --bar 1
As a workaround, I can fall back to the original `args`, but I am curious if there is any chance to utilize the capabilities that `CommandLineParser` offers. Does anyone have an idea on how to configure `CommandLineParser` to achieve this?
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先检查当后续 token 类似于选项时,CommandLineParser 如何绑定 [Verb] 和 [Value] 成员。重现示例 `foreach foo bar baz -f true --foo --bar 1`,并将 parser 的行为与转发原始 args 的行为进行比较。在确定是否支持精确保留参数,并记录或实现相应配置后,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100