Unit test to reproduce the -v/--version bug

This commit is contained in:
Frank Ray
2024-01-06 16:38:33 +00:00
committed by Patrik Svensson
parent 5a52c1f277
commit d03c10623c
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,18 @@
namespace Spectre.Console.Tests.Data;
public sealed class VersionCommand : Command<VersionSettings>
{
private readonly IAnsiConsole _console;
public VersionCommand(IAnsiConsole console)
{
_console = console;
}
public override int Execute(CommandContext context, VersionSettings settings)
{
_console.WriteLine($"VersionCommand ran, Version: {settings.Version ?? string.Empty}");
return 0;
}
}

View File

@ -0,0 +1,7 @@
namespace Spectre.Console.Tests.Data;
public sealed class VersionSettings : CommandSettings
{
[CommandOption("-v|--version")]
public string Version { get; set; }
}