initial commit
This commit is contained in:
34
Commands/StatusCommand.cs
Normal file
34
Commands/StatusCommand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Spectre.Console;
|
||||
namespace AnchorCli.Commands;
|
||||
|
||||
public class StatusCommand : ICommand
|
||||
{
|
||||
private readonly string _model;
|
||||
private readonly string _endpoint;
|
||||
|
||||
public StatusCommand(string model, string endpoint)
|
||||
{
|
||||
_model = model;
|
||||
_endpoint = endpoint;
|
||||
}
|
||||
|
||||
public string Name => "status";
|
||||
public string Description => "Show current settings (model, endpoint, working directory)";
|
||||
|
||||
public Task ExecuteAsync(string[] args, CancellationToken ct)
|
||||
{
|
||||
var table = new Table()
|
||||
.Border(TableBorder.Rounded)
|
||||
.BorderColor(Color.Grey)
|
||||
.AddColumn(new TableColumn("[dim]Setting[/]").NoWrap())
|
||||
.AddColumn(new TableColumn("[dim]Value[/]"));
|
||||
|
||||
table.AddRow("[grey]Model[/]", $"[cyan]{Markup.Escape(_model)}[/]");
|
||||
table.AddRow("[grey]Endpoint[/]", $"[blue]{Markup.Escape(_endpoint)}[/]");
|
||||
table.AddRow("[grey]CWD[/]", $"[green]{Markup.Escape(Environment.CurrentDirectory)}[/]");
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AnsiConsole.WriteLine();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user