using NozCli.Repl; using Spectre.Console; namespace NozCli.Commands; public class TemplatesCommand : ICommand { public string Name => "templates"; public string Description => "List available note templates"; public string Usage => "templates"; public async Task ExecuteAsync(string[] args, ReplContext ctx, CancellationToken ct = default) { List templates = []; await AnsiConsole.Status().StartAsync("Lade Templates…", async _ => templates = await ctx.Api.GetTemplatesAsync(ct)); if (templates.Count == 0) { AnsiConsole.MarkupLine("[dim]Keine Templates vorhanden.[/]"); AnsiConsole.MarkupLine("[dim]Lege Templates in [white]content/noosphere/_templates/.md[/] an.[/]"); return; } var table = new Table() .AddColumn("[dim]Name[/]") .AddColumn("[dim]Beschreibung[/]") .Border(TableBorder.None) .HideHeaders(); foreach (var t in templates.OrderBy(t => t.Name)) table.AddRow( $"[cyan]{Markup.Escape(t.Name)}[/]", Markup.Escape(t.Description ?? "—")); AnsiConsole.Write(table); AnsiConsole.MarkupLine($"[dim]Verwenden mit:[/] [white]new --template [/]"); } }