Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Example with Option with IEnumerable<string> broken - Sequence contains more than one element #377
Comments
|
Actually, this was an issue instead with Parsing a Dict Is this supported? |
|
No, unfortunately dicts are not supported |
|
A dictionary would be hard to support... what generates the keys for the values? I would believe this is undefined in the getopt specs that this library strives to follow. |
|
I think you are correct Eric that it would be hard to support. I think this is more about protecting against dumb new user and a clearer exception behavior than implementing support :). As a C# dev, Dictionary is popular and for better or worse, it's what I expected/hoped to use here as one of the cmd line options. The above is actually misleading, as I thought the IEnumerable is what was causing the issue, but instead the Dict used as another possible cmd-line parameter (turns out didn't need it) My suggestion is the user adds odd or not supported stuff, that we have a clearer exception than |
|
Indeed. The error is misleading. |


Running the latest commandlineparser v2.3.0 on .Net Core 2.1.
The library example doesn't seem to work at all parsing IEnumerable
[Option('r', "read", Required = true, HelpText = "Input files to be processed.")]
public IEnumerable InputFiles { get; set; }
If you specify --read file1 file2 you get this exception:
System.InvalidOperationException
HResult=0x80131509
Message=Sequence contains more than one element
Source=System.Linq
StackTrace: