mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38:16 +08:00

* Renames Spectre.Cli to Spectre.Console.Cli. * Now uses Verify with Spectre.Console.Cli tests. * Removes some duplicate definitions. Closes #168
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
namespace Spectre.Console.Cli.Internal
|
|
{
|
|
[Description("Displays the CLI library version")]
|
|
[SuppressMessage("Performance", "CA1812: Avoid uninstantiated internal classes")]
|
|
internal sealed class VersionCommand : Command<VersionCommand.Settings>
|
|
{
|
|
private readonly IAnsiConsole _writer;
|
|
|
|
public VersionCommand(IConfiguration configuration)
|
|
{
|
|
_writer = configuration.Settings.Console.GetConsole();
|
|
}
|
|
|
|
public sealed class Settings : CommandSettings
|
|
{
|
|
}
|
|
|
|
public override int Execute([NotNull] CommandContext context, [NotNull] Settings settings)
|
|
{
|
|
_writer.MarkupLine(
|
|
"[yellow]Spectre.Cli[/] version [aqua]{0}[/]",
|
|
VersionHelper.GetVersion(typeof(VersionCommand)?.Assembly));
|
|
|
|
_writer.MarkupLine(
|
|
"[yellow]Spectre.Console[/] version [aqua]{0}[/]",
|
|
VersionHelper.GetVersion(typeof(IAnsiConsole)?.Assembly));
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|