From 4cf622abe5145d3a5d84b362be162f3b8d03c70b Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Mon, 27 Jan 2020 21:50:25 +0200 Subject: [PATCH] Add Cocona to benchmarks --- CliFx.Benchmarks/Benchmark.cs | 6 +++++- CliFx.Benchmarks/CliFx.Benchmarks.csproj | 1 + CliFx.Benchmarks/Commands/CoconaCommand.cs | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CliFx.Benchmarks/Commands/CoconaCommand.cs diff --git a/CliFx.Benchmarks/Benchmark.cs b/CliFx.Benchmarks/Benchmark.cs index 9bd0603..2ecb333 100644 --- a/CliFx.Benchmarks/Benchmark.cs +++ b/CliFx.Benchmarks/Benchmark.cs @@ -27,7 +27,7 @@ namespace CliFx.Benchmarks [Benchmark(Description = "CommandLineParser")] public void ExecuteWithCommandLineParser() => - new CommandLine.Parser() + new Parser() .ParseArguments(Arguments, typeof(CommandLineParserCommand)) .WithParsed(c => c.Execute()); @@ -38,5 +38,9 @@ namespace CliFx.Benchmarks [Benchmark(Description = "Clipr")] public void ExecuteWithClipr() => clipr.CliParser.Parse(Arguments).Execute(); + + [Benchmark(Description = "Cocona")] + public void ExecuteWithCocona() => + Cocona.CoconaApp.Run(Arguments); } } \ No newline at end of file diff --git a/CliFx.Benchmarks/CliFx.Benchmarks.csproj b/CliFx.Benchmarks/CliFx.Benchmarks.csproj index 95be2ea..288472c 100644 --- a/CliFx.Benchmarks/CliFx.Benchmarks.csproj +++ b/CliFx.Benchmarks/CliFx.Benchmarks.csproj @@ -9,6 +9,7 @@ + diff --git a/CliFx.Benchmarks/Commands/CoconaCommand.cs b/CliFx.Benchmarks/Commands/CoconaCommand.cs new file mode 100644 index 0000000..65deaef --- /dev/null +++ b/CliFx.Benchmarks/Commands/CoconaCommand.cs @@ -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) + { + } + } +} \ No newline at end of file