Update the lexer to support specifying an option that supports more than one argument using a comma-separated list:
e.g. DisplayTable -column FirstColumn, SecondColumn
Whitespace around the comma is allowed.
Regex patterns are definitely not my forte, so if someone else sees this and wants it done faster than I can do, feel free to take it (and if possible, I'd love to pair on it). I'll make sure to push any tests I write to a WIP PR.
@PandaMagnus, the lexer isn't using a regex, but the tokenizer is. This feature would impact both, assuming spaces between comma-grouped items are allowed as in @MarkMichaelis's example.
@jonsequitur Understood. I'll make sure to take a look at the lexer as well. If I get in over my head I'll pair or set it aside.
I expect that the lexer and core parse operations will need an overhaul at some point. The implementation isn't elegant and the performance needs to be improved. That might be the kind of thing that we undertake first, with improvements like this in mind, before adding support for additional cases.
In addition to , as a split delimiter, I've seen examples of | and ;, so making the actual split delimiter configurable by the user would be a good idea.
@srsaggam
@CESARDELATORRE
[Fact]
public void custom_parsing_of_sequence_value_from_an_argument_with_one_token()
{
var argument = new Argument<IEnumerable<int>>(result =>
{
result.Value = result.Tokens.Single().Value.Split(",").Select(int.Parse);
return true;
});
argument.Parse("1,2,3")
.FindResultFor(argument)
.GetValueOrDefault()
.Should()
.BeEquivalentTo(new[] { 1, 2, 3 });
}