Unable to parse TimeSpan given from FormatCommandLine
Qrtic opened this issue · 2 comments
Qrtic commented
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()));
Qrtic commented
gsscoder repository is not used for CommandLineParser right now.
Moved to issue link
gsscoder commented
@Qrtic, project moved to https://github.com/commandlineparser/commandline.
But I see you find the right place!