fix color formatting core dump

This commit is contained in:
2026-05-20 11:20:00 +02:00
parent 27cf1b6314
commit 3e9d80fe98
3 changed files with 74 additions and 33 deletions
+15 -7
View File
@@ -38,22 +38,30 @@ public static class OperationForms
if (error is not null)
AnsiConsole.MarkupLine($"[yellow][[WARN]] Could not fetch schemas: {Markup.Escape(error)}[/]");
var choices = new List<string>(schemas);
choices.Add("[dim][ Enter manually ][/]");
choices.Add("[dim][ Cancel ][/]");
// Use sentinel strings as values so no markup leaks into choice labels
const string manualSentinel = "__MANUAL__";
const string cancelSentinel = "__CANCEL__";
var choiceValues = new List<string>(schemas) { manualSentinel, cancelSentinel };
var prompt = new SelectionPrompt<string>()
.Title($"[bold]{title}[/]")
.Title($"[bold]{Markup.Escape(title)}[/]")
.PageSize(15)
.HighlightStyle(Style.Parse("bold dodgerblue1"))
.AddChoices(choices);
.UseConverter(v => v switch
{
manualSentinel => "[ Enter manually ]",
cancelSentinel => "[ Cancel ]",
_ => v,
})
.AddChoices(choiceValues);
var selected = AnsiConsole.Prompt(prompt);
if (selected.Contains("Cancel"))
if (selected == cancelSentinel)
return null;
if (selected.Contains("manually"))
if (selected == manualSentinel)
{
var manual = AnsiConsole.Ask<string>("Enter schema name:").Trim();
return string.IsNullOrWhiteSpace(manual) ? null : manual;