commandlineparser / commandlineparser/commandline

AutoHelp and AutoVersion don't work when the arguments contain executable name

未關閉
#829 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C#
星號
4.8k
分支
478
PR 合併指標
30 天內沒有已合併 PR

描述

`Environment.GetCommandLineArgs()` returns arguments including the program path (but not including `dotnet`):
```cs
{ "/Users/usrsse2/project/CLI/bin/Debug/net6.0/CLI.dll", "--version" }
```
When I pass it into `ParseArguments`, it correctly parses all options and values defined in my T, but for `--help` and `--version` returns `UnknownOptionError` instead of the expected `HelpRequestedError` and `VersionRequestedError`. When I pass `Environment.GetCommandLineArgs().Skip(1)`, it works correctly.

This is probably related to #600, because `--help` is recognized only if it's the first option.

貢獻指南

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

研究方向

將 Environment.GetCommandLineArgs() 傳遞給 ParseArguments 來重現問題,然後與 Skip(1) 的情況進行比較,並檢視 #600 所參照的行為。即使可執行檔路徑是第一個引數,--help 和 --version 仍會產生 HelpRequestedError 和 VersionRequestedError,即表示工作完成。

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

評估

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

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

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