We recently upgraded the nuget package from version 1.9.71 to version 2.2.1 and noticed that the behavior for the default parser has changed. It used to be that the options and enum values were case insensitive by default... but now they are case sensitive. This is a concern because users now may get usage errors since they will likely use the wrong case.
I understand the argument for following C# standards... but for most CLI utilities that I have seen, case insensitive options are typical.
I realize that I can override this behavior... but it just seems like being case insensitive is what would make most sense for most applications. Is it possible make this the default again?
Or alternatively, provide a new default that is case insensitive?
var parser = new Parser(settings =>
{
settings.CaseSensitive = false;
});
Thanks @finnball, that is what I ended doing in my code. The issue is that it just feels like this would be a useful Default that should come as part of the library because (a) most people expect command line utilities to be case insensitive and (b) it was the behavior in prior versions of the library
There was an offline discussion about this, and we feel like the default case sensitive being on is what would be normal for a command line parsing library, unless otherwise stated. This follows the pattern from many other command tools are case sensitive as well.
Of course, there's probably several examples of case insensitive, however we feel like its the right decision.
You do mention an important topic: an upgrade guide should definitely notate this change in behavior from v1.9 to v2+
@ericnewton76 Windows shell commands are typically not case sensitive. Curious where you thought otherwise. Were you thinking of Linux tools?
Yes, this library is modeled off of the Linux getopt parsing style, which is case sensitive. This is also why it uses - and -- rather than / or - for short and long arguments.
It's used on Windows primarily, suggest following Windows shell conventions regarding case sensitivity (making it not case sensitive, by default). You confuse most end users, as it is.
As .NET is very much positioned as a cross platform solution I think it is very good to use the -/-- style command line flags.
This ticket is only about case sensitivity. Do not default to the bad part of Linux (case sensitivity). Windows is not case sensitive and should not be.
Also remember to set the HelpWriter property:
var parser = new Parser(c =>
{
c.CaseSensitive = false;
c.HelpWriter = Console.Error;
});
Most helpful comment
It's used on Windows primarily, suggest following Windows shell conventions regarding case sensitivity (making it not case sensitive, by default). You confuse most end users, as it is.