commandlineparser / commandlineparser/commandline

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

Offen
#829 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C#
Sterne
4.8k
Forks
478
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

`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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.