Closed
Description
Consider following definition of options:
class Options
{
[Option('c', "channels", Required = true, Separator = ':', HelpText = "Channel names")]
public IEnumerable<string> Channels { get; set; }
[Value(0,
Required = true,
MetaName = "file_path",
HelpText = "Path of archive to be processed")]
public string ArchivePath { get; set; }
}
When invoking app.exe -c chanA:chanB file.hdf5
the expected result would be
Channels = {"chanA", "chanB"}
ArchivePath = "file.hdf5"
Instead, I get a CommandLine.MissingRequiredOptionError
If I remove the Required
attribute from the value definition, parsing succeeds but I get:
Channels = {"chanA", "chanB", "file.hdf5"}
And the expected ArchivePath
value ends up in the Channels
definitions (why? there is no ":" separator)
Am I doing something wrong?