SvenGroot / Ookii.CommandLine

Ookii.CommandLine is a powerful and flexible command line argument parsing library for .Net applications, supporting PowerShell-like and POSIX-like conventions, as well as subcommands.
MIT License
27 stars 7 forks source link

Double dash for argument prefix #5

Closed dmarlow closed 2 years ago

dmarlow commented 4 years ago

I'm specifying the argument prefix like this: var parser = new CommandLineParser(typeof(Options), new[] { "-", "--" });

But, when I attempt to use -- like this: myapp.exe --flag

I get the following error: Unknown argument name '-flag'.

Looks like if I switch the order of the prefixes, it works. 🤷‍♂

SvenGroot commented 2 years ago

This is working as intended. The prefixes are checked in the order they are provided, so when - matches, -- is never considered. As you indicated, the solution is to specify the longer prefixes first.