commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Parsing fails on nullable types

Open akbyrd opened this issue 10 years ago • 0 comments

The command line myapp -s 60 will fail to parse using the following code:

static void Main ( string[] args )
{
    var result = CommandLine.Parser.Default.ParseArguments<Options>(args);
    if ( result.Errors.Any() ) { return; }

    Console.WriteLine(result.Value.SetRefreshRate);
}

public class Options
{
    [CommandLine.Option('s', "SetRefreshRate")]
    public int? SetRefreshRate { get; set; }
}

According to https://github.com/cosmo0/commandline/wiki/Mapping-Properties-To-Options this should be supported.

Tested on 2.0.0.0 and 2.1.0.0

akbyrd avatar May 31 '15 18:05 akbyrd