mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Add benchmarks
This commit is contained in:
34
CliFx.Benchmarks/Commands/SystemCommandLineCommand.cs
Normal file
34
CliFx.Benchmarks/Commands/SystemCommandLineCommand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.Invocation;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CliFx.Benchmarks.Commands
|
||||
{
|
||||
public class SystemCommandLineCommand
|
||||
{
|
||||
public static int ExecuteHandler(string s, int i, bool b) => 0;
|
||||
|
||||
public Task<int> ExecuteAsync(string[] args)
|
||||
{
|
||||
var command = new RootCommand
|
||||
{
|
||||
new Option(new[] {"--str", "-s"})
|
||||
{
|
||||
Argument = new Argument<string>()
|
||||
},
|
||||
new Option(new[] {"--int", "-i"})
|
||||
{
|
||||
Argument = new Argument<int>()
|
||||
},
|
||||
new Option(new[] {"--bool", "-b"})
|
||||
{
|
||||
Argument = new Argument<bool>()
|
||||
}
|
||||
};
|
||||
|
||||
command.Handler = CommandHandler.Create(typeof(SystemCommandLineCommand).GetMethod(nameof(ExecuteHandler)));
|
||||
|
||||
return command.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user