Skip to content
This repository was archived by the owner on Jul 11, 2018. It is now read-only.
This repository was archived by the owner on Jul 11, 2018. It is now read-only.

Case sensitivity settings not respected #16

@refactorsaurusrex

Description

@refactorsaurusrex

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions