commandline icon indicating copy to clipboard operation
commandline copied to clipboard

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

Open usr-sse2 opened this issue 3 years ago • 0 comments

Environment.GetCommandLineArgs() returns arguments including the program path (but not including dotnet):

{ "/Users/usrsse2/project/CLI/bin/Debug/net6.0/CLI.dll", "--version" }

When I pass it into ParseArguments<T>, 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.

usr-sse2 avatar Jun 17 '22 09:06 usr-sse2