Add Cocona to benchmarks

This commit is contained in:
Alexey Golub
2020-01-27 21:50:25 +02:00
parent d4e22a78d6
commit 4cf622abe5
3 changed files with 23 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ namespace CliFx.Benchmarks
[Benchmark(Description = "CommandLineParser")]
public void ExecuteWithCommandLineParser() =>
new CommandLine.Parser()
new Parser()
.ParseArguments(Arguments, typeof(CommandLineParserCommand))
.WithParsed<CommandLineParserCommand>(c => c.Execute());
@@ -38,5 +38,9 @@ namespace CliFx.Benchmarks
[Benchmark(Description = "Clipr")]
public void ExecuteWithClipr() =>
clipr.CliParser.Parse<CliprCommand>(Arguments).Execute();
[Benchmark(Description = "Cocona")]
public void ExecuteWithCocona() =>
Cocona.CoconaApp.Run<CoconaCommand>(Arguments);
}
}

View File

@@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="clipr" Version="1.6.1" />
<PackageReference Include="Cocona" Version="1.0.0" />
<PackageReference Include="CommandLineParser" Version="2.7.82" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.5.0" />
<PackageReference Include="PowerArgs" Version="3.6.0" />

View File

@@ -0,0 +1,17 @@
using Cocona;
namespace CliFx.Benchmarks.Commands
{
public class CoconaCommand
{
public void Execute(
[Option("str", new []{'s'})]
string? strOption,
[Option("int", new []{'i'})]
int intOption,
[Option("bool", new []{'b'})]
bool boolOption)
{
}
}
}