feat: add version string to startup and status menu
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
using System.Linq;
|
using System.Reflection;
|
||||||
namespace AnchorCli.Commands;
|
namespace AnchorCli.Commands;
|
||||||
|
|
||||||
public class HelpCommand : ICommand
|
public class HelpCommand : ICommand
|
||||||
@@ -16,6 +16,8 @@ public class HelpCommand : ICommand
|
|||||||
|
|
||||||
public Task ExecuteAsync(string[] args, CancellationToken ct)
|
public Task ExecuteAsync(string[] args, CancellationToken ct)
|
||||||
{
|
{
|
||||||
|
var version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown";
|
||||||
|
AnsiConsole.MarkupLine($"[cyan]Anchor CLI v{version}[/]");
|
||||||
AnsiConsole.MarkupLine("[cyan]Available commands:[/]");
|
AnsiConsole.MarkupLine("[cyan]Available commands:[/]");
|
||||||
|
|
||||||
var table = new Table();
|
var table = new Table();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
using System.Reflection;
|
||||||
namespace AnchorCli.Commands;
|
namespace AnchorCli.Commands;
|
||||||
|
|
||||||
public class StatusCommand : ICommand
|
public class StatusCommand : ICommand
|
||||||
@@ -25,6 +26,7 @@ public class StatusCommand : ICommand
|
|||||||
|
|
||||||
table.AddRow("[grey]Model[/]", $"[cyan]{Markup.Escape(_model)}[/]");
|
table.AddRow("[grey]Model[/]", $"[cyan]{Markup.Escape(_model)}[/]");
|
||||||
table.AddRow("[grey]Endpoint[/]", $"[blue]{Markup.Escape(_endpoint)}[/]");
|
table.AddRow("[grey]Endpoint[/]", $"[blue]{Markup.Escape(_endpoint)}[/]");
|
||||||
|
table.AddRow("[grey]Version[/]", $"[magenta]{Assembly.GetExecutingAssembly().GetName().Version}[/]");
|
||||||
table.AddRow("[grey]CWD[/]", $"[green]{Markup.Escape(Environment.CurrentDirectory)}[/]");
|
table.AddRow("[grey]CWD[/]", $"[green]{Markup.Escape(Environment.CurrentDirectory)}[/]");
|
||||||
|
|
||||||
AnsiConsole.Write(table);
|
AnsiConsole.Write(table);
|
||||||
|
|||||||
13
Program.cs
13
Program.cs
@@ -1,4 +1,5 @@
|
|||||||
using System.ClientModel;
|
using System.ClientModel;
|
||||||
|
using System.Reflection;
|
||||||
using AnchorCli.Providers;
|
using AnchorCli.Providers;
|
||||||
using Microsoft.Extensions.AI;
|
using Microsoft.Extensions.AI;
|
||||||
using OpenAI;
|
using OpenAI;
|
||||||
@@ -56,11 +57,20 @@ if (ProviderFactory.IsOpenRouter(endpoint))
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ── Pretty header ───────────────────────────────────────────────────────
|
// ── Pretty header ───────────────────────────────────────────────────────
|
||||||
AnsiConsole.Write(
|
AnsiConsole.Write(
|
||||||
new FigletText("anchor")
|
new FigletText("anchor")
|
||||||
.Color(Color.CornflowerBlue));
|
.Color(Color.CornflowerBlue));
|
||||||
|
|
||||||
|
var version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown";
|
||||||
|
|
||||||
|
AnsiConsole.Write(
|
||||||
|
new Rule("[dim]AI-powered coding assistant[/]")
|
||||||
|
.RuleStyle(Style.Parse("cornflowerblue dim"))
|
||||||
|
.LeftJustified());
|
||||||
|
// ── Pretty header ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
AnsiConsole.Write(
|
AnsiConsole.Write(
|
||||||
new Rule("[dim]AI-powered coding assistant[/]")
|
new Rule("[dim]AI-powered coding assistant[/]")
|
||||||
.RuleStyle(Style.Parse("cornflowerblue dim"))
|
.RuleStyle(Style.Parse("cornflowerblue dim"))
|
||||||
@@ -77,11 +87,10 @@ var infoTable = new Table()
|
|||||||
infoTable.AddRow("[grey]Model[/]", $"[cyan]{Markup.Escape(modelInfo?.Name ?? model)}[/]");
|
infoTable.AddRow("[grey]Model[/]", $"[cyan]{Markup.Escape(modelInfo?.Name ?? model)}[/]");
|
||||||
infoTable.AddRow("[grey]Provider[/]", $"[blue]{tokenExtractor.ProviderName}[/]");
|
infoTable.AddRow("[grey]Provider[/]", $"[blue]{tokenExtractor.ProviderName}[/]");
|
||||||
infoTable.AddRow("[grey]Endpoint[/]", $"[dim]{endpoint}[/]");
|
infoTable.AddRow("[grey]Endpoint[/]", $"[dim]{endpoint}[/]");
|
||||||
infoTable.AddRow("[grey]CWD[/]", $"[green]{Markup.Escape(Environment.CurrentDirectory)}[/]");
|
infoTable.AddRow("[grey]Version[/]", $"[magenta]{version}[/]");
|
||||||
|
|
||||||
if (modelInfo?.Pricing != null)
|
if (modelInfo?.Pricing != null)
|
||||||
|
|
||||||
if (modelInfo?.Pricing != null)
|
|
||||||
{
|
{
|
||||||
var inM = tokenTracker.InputPrice * 1_000_000m;
|
var inM = tokenTracker.InputPrice * 1_000_000m;
|
||||||
var outM = tokenTracker.OutputPrice * 1_000_000m;
|
var outM = tokenTracker.OutputPrice * 1_000_000m;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user