commandline
commandline copied to clipboard
Case sensitivity settings not respected
This example is taken straight out of the documentation. Doesn't matter if I explicitly set CaseSensitive = false or use the default options, "bye" will not parse to GreetType.Bye. However, "Bye" does work correctly. I tried this in version 2.0 and 2.1.
class Program
{
// Args: -g bye
static void Main(string[] args)
{
var parser = new Parser(x => x.CaseSensitive = false);
// ArgumentException: Requested value 'bye' was not found.
var result1 = parser.ParseArguments<Options>(args);
// ArgumentException: Requested value 'bye' was not found.
var result2 = CommandLine.Parser.Default.ParseArguments<Options>(args);
}
}
class Options
{
[Option('g', "greet-type")]
public GreetType SpecifiedGreetType { get; set; }
}
enum GreetType
{
Hello,
Bye,
Regards
}