From 6a06cdc4221c439d39b2423e60773ca44f0f9a87 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Sun, 11 Aug 2019 18:44:35 +0300 Subject: [PATCH] Fix benchmarks --- CliFx.Benchmarks/Benchmark.cs | 2 +- CliFx/CliApplicationBuilder.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CliFx.Benchmarks/Benchmark.cs b/CliFx.Benchmarks/Benchmark.cs index 21de1df..04ac138 100644 --- a/CliFx.Benchmarks/Benchmark.cs +++ b/CliFx.Benchmarks/Benchmark.cs @@ -11,7 +11,7 @@ namespace CliFx.Benchmarks private static readonly string[] Arguments = { "--str", "hello world", "-i", "13", "-b" }; [Benchmark(Description = "CliFx", Baseline = true)] - public Task ExecuteWithCliFx() => new CliApplication(new[] {typeof(CliFxCommand)}).RunAsync(Arguments); + public Task ExecuteWithCliFx() => new CliApplicationBuilder().WithCommand(typeof(CliFxCommand)).Build().RunAsync(Arguments); [Benchmark(Description = "System.CommandLine")] public Task ExecuteWithSystemCommandLine() => new SystemCommandLineCommand().ExecuteAsync(Arguments); diff --git a/CliFx/CliApplicationBuilder.cs b/CliFx/CliApplicationBuilder.cs index cc74e92..dfadce0 100644 --- a/CliFx/CliApplicationBuilder.cs +++ b/CliFx/CliApplicationBuilder.cs @@ -78,10 +78,10 @@ namespace CliFx var commandFactory = _commandFactory ?? new CommandFactory(); // Project parameters to expected types - var applicationMetadata = new ApplicationMetadata(title, executableName, versionText); + var metadata = new ApplicationMetadata(title, executableName, versionText); var commandTypes = _commandTypes.ToArray(); - return new CliApplication(applicationMetadata, commandTypes, + return new CliApplication(metadata, commandTypes, console, new CommandInputParser(), new CommandSchemaResolver(), commandFactory, new CommandInitializer(), new CommandHelpTextRenderer(console)); }