-
Notifications
You must be signed in to change notification settings - Fork 483
Closed
Milestone
Description
It seems like starting from version 2.7 a bug in unparsing of TimeSpan options appeared.
Version 2.6 unparsing results in unquoted timespan value (i.e. 00:01:00), whereas version's 2.7 or 2.7.82 is quoted (i.e. "00:01:00"), which couldn't be parsed.
Was it intended to be quoted and it should be properly parsed then?
Here's a sample code, which describes an issue.
var args = Parser.Default.FormatCommandLine(new Options
{
Interval = TimeSpan.FromMinutes(1)
}).Split(' ');
// results in quoted TimeSpan: --interval "00:01:00"
// which throws on parsing with CommandLine.BadFormatConversionError
Parser.Default.ParseArguments<Options>(args)
.MapResult(
options => options,
errs => throw new Exception(errs.First().ToString()));