mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 05:48:14 +08:00
Add Spectre.Cli to Spectre.Console
* Renames Spectre.Cli to Spectre.Console.Cli. * Now uses Verify with Spectre.Console.Cli tests. * Removes some duplicate definitions. Closes #168
This commit is contained in:

committed by
Patrik Svensson

parent
0bbf9b81a9
commit
0ae419326d
34
src/Spectre.Console/Cli/Internal/Commands/VersionCommand.cs
Normal file
34
src/Spectre.Console/Cli/Internal/Commands/VersionCommand.cs
Normal file
@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user