mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
28 lines
701 B
C#
28 lines
701 B
C#
using BenchmarkDotNet.Attributes;
|
|
using CommandLine;
|
|
|
|
namespace CliFx.Benchmarks;
|
|
|
|
public partial class Benchmarks
|
|
{
|
|
public class CommandLineParserCommand
|
|
{
|
|
[Option('s', "str")]
|
|
public string? StrOption { get; set; }
|
|
|
|
[Option('i', "int")]
|
|
public int IntOption { get; set; }
|
|
|
|
[Option('b', "bool")]
|
|
public bool BoolOption { get; set; }
|
|
|
|
public void Execute() { }
|
|
}
|
|
|
|
[Benchmark(Description = "CommandLineParser")]
|
|
public void ExecuteWithCommandLineParser() =>
|
|
new Parser()
|
|
.ParseArguments(Arguments, typeof(CommandLineParserCommand))
|
|
.WithParsed<CommandLineParserCommand>(c => c.Execute());
|
|
}
|