commandlineparser / commandlineparser/commandline

How to pass and retain subsequent arguments to a verb with exact format?

未關閉
#902 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
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?

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start by examining how CommandLineParser binds [Verb] and [Value] members when subsequent tokens resemble options. Reproduce the example `foreach foo bar baz -f true --foo --bar 1` and compare parser behavior with forwarding the original args. Done means determining whether exact argument preservation is supported and documenting or implementing the appropriate configuration.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
cli
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。