MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / printGuardrailVerdict

Function printGuardrailVerdict

cmd/pulumi.go:437–448  ·  view source on GitHub ↗

printGuardrailVerdict writes a coloured pass/fail summary to stderr, keeping stdout reserved for the estimate tables.

(g estimate.GuardrailResult)

Source from the content-addressed store, hash-verified

435// printGuardrailVerdict writes a coloured pass/fail summary to stderr, keeping
436// stdout reserved for the estimate tables.
437func printGuardrailVerdict(g estimate.GuardrailResult) {
438 if g.Passed {
439 st := lipgloss.NewStyle().Foreground(lipgloss.Color("#22C55E")).Bold(true)
440 fmt.Fprintln(os.Stderr, st.Render(fmt.Sprintf("✓ GUARDRAIL PASSED — monthly $%.2f", g.MonthlyTotal)))
441 return
442 }
443 st := lipgloss.NewStyle().Foreground(lipgloss.Color("#EF4444")).Bold(true)
444 fmt.Fprintln(os.Stderr, st.Render("✗ GUARDRAIL FAILED:"))
445 for _, b := range g.Breaches {
446 fmt.Fprintln(os.Stderr, st.Render(" • "+b))
447 }
448}
449
450// guardrailBreachError signals that a cost guardrail threshold was exceeded.
451// Execute() maps it to exit code 2 (distinct from 1 = runtime error).

Callers 1

runPulumiEstimateFunction · 0.85

Calls 1

RenderMethod · 0.45

Tested by

no test coverage detected