I'm trying to switch BenchmarkDotNet (dotnet/BenchmarkDotNet#1016) to System.CommandLine.
But I have one problem. Currently BenchmarkDotNet uses multiple value of argument e.g.:
dotnet run -c Release -- --runtimes net472 netcoreapp2.1
or
--filter *ClassA* *ClassB*
Currently System.CommandLine doesn't support this. When I configure option:
Option Filter() => new Option(new[] { "-r", "--runtimes" },
"Full target framework moniker for .NET Core and .NET. For Mono just 'Mono', for CoreRT just 'CoreRT'. First one will be marked as baseline!",
new Argument<string[]>());
I have to repeat an alias for each parameter value, like this:
--runtimes net472 --runtimes netcoreapp2.1
The worst scenario, instead:
--filter *ClassA* *ClassB* --runtimes net472 netcoreapp2.1 --exporters GitHub StackOverflow RPlot CSV JSON HTML XML --attribute Attribute1 Attribute2
we should type this:
--filter *ClassA* --filter *ClassB* --runtimes net472 --runtimes netcoreapp2.1 --exporters GitHub --exporters StackOverflow --exporters RPlot --exporters CSV --exporters JSON --exporters HTML --exporters XML --attribute Attribute1 --attribute Attribute2
This example doesn't contain other attributes that can have one value.
There is unit test that shows it doesn't work
|
[InlineData("--one 1 --many 1 --many 2")] |
|
[InlineData("--one 1 --many 1 --many 2 arg1 arg2")] |
|
[InlineData("--many 1 --one 1 --many 2")] |
|
[InlineData("--many 2 --many 1 --one 1")] |
|
[InlineData("--many:2 --many=1 --one 1")] |
|
[InlineData("[parse] --one 1 --many 1 --many 2")] |
|
[InlineData("--one \"stuff in quotes\" this-is-arg1 \"this is arg2\"")] |
|
[InlineData("not a valid command line --one 1")] |
|
public void Original_order_of_tokens_is_preserved_in_ParseResult_Tokens(string commandLine) |
I'm trying to switch BenchmarkDotNet (dotnet/BenchmarkDotNet#1016) to
System.CommandLine.But I have one problem. Currently BenchmarkDotNet uses multiple value of argument e.g.:
dotnet run -c Release -- --runtimes net472 netcoreapp2.1or
--filter *ClassA* *ClassB*Currently
System.CommandLinedoesn't support this. When I configure option:I have to repeat an alias for each parameter value, like this:
--runtimes net472 --runtimes netcoreapp2.1The worst scenario, instead:
--filter *ClassA* *ClassB* --runtimes net472 netcoreapp2.1 --exporters GitHub StackOverflow RPlot CSV JSON HTML XML --attribute Attribute1 Attribute2we should type this:
--filter *ClassA* --filter *ClassB* --runtimes net472 --runtimes netcoreapp2.1 --exporters GitHub --exporters StackOverflow --exporters RPlot --exporters CSV --exporters JSON --exporters HTML --exporters XML --attribute Attribute1 --attribute Attribute2This example doesn't contain other attributes that can have one value.
There is unit test that shows it doesn't work
command-line-api/src/System.CommandLine.Tests/ParserTests.cs
Lines 570 to 578 in 4f3b654