commandlineparser / commandlineparser/commandline
AutoHelp and AutoVersion don't work when the arguments contain executable name
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 478
- PR merge metrics
- No merged PRs in 30d
Description
`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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.