commandlineparser / commandlineparser/commandline
AutoHelp and AutoVersion don't work when the arguments contain executable name
- 主要言語
- 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