Initial commit (history squashed)

This commit is contained in:
master
2025-10-07 10:14:21 +03:00
commit 016c5a3fe7
1132 changed files with 117842 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
using Spectre.Console;
namespace StellaOps.Cli.Prompts;
internal static class TrivyDbExportPrompt
{
public static (bool? publishFull, bool? publishDelta, bool? includeFull, bool? includeDelta) PromptOverrides()
{
if (!AnsiConsole.Profile.Capabilities.Interactive)
{
return (null, null, null, null);
}
AnsiConsole.Write(
new Panel("[bold]Trivy DB Export Overrides[/]")
.Border(BoxBorder.Rounded)
.Header("Trivy DB")
.Collapse());
var shouldOverride = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("Adjust publishing or offline bundle behaviour?")
.AddChoices("Leave defaults", "Override"));
if (shouldOverride == "Leave defaults")
{
return (null, null, null, null);
}
var publishFull = PromptBoolean("Push full exports to ORAS?");
var publishDelta = PromptBoolean("Push delta exports to ORAS?");
var includeFull = PromptBoolean("Include full exports in offline bundle?");
var includeDelta = PromptBoolean("Include delta exports in offline bundle?");
return (publishFull, publishDelta, includeFull, includeDelta);
}
private static bool? PromptBoolean(string question)
{
var choice = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title($"{question} [grey](select override or keep default)[/]")
.AddChoices("Keep default", "Yes", "No"));
return choice switch
{
"Yes" => true,
"No" => false,
_ => (bool?)null,
};
}
}