Documentation
¶
Overview ¶
Package ui provides centralized styling and output helpers for the CLI.
Uses charmbracelet/lipgloss for styled terminal output. All commands import this package for consistent branding.
Index ¶
- Variables
- func Banner(text string)
- func BannerStr(text string) string
- func Brand(msg string) string
- func Divider()
- func Error(msg string)
- func ErrorWithSuggestions(err error, suggestions ...string)
- func Info(msg string)
- func RenderTable(headers []string, rows [][]string) string
- func Spinner(title string, fn func() error) error
- func StatusRow(key, value string)
- func StatusRowDim(key, value string)
- func Success(msg string)
- func SuccessWithSuggestions(msg string, nextSteps ...string)
- func Warning(msg string)
Constants ¶
This section is empty.
Variables ¶
var ( PrimaryColor = lipgloss.Color("#7DD3FC") // Sky Blue Secondary = lipgloss.Color("#BAE6FD") // Light Sky Blue SuccessColor = lipgloss.Color("#34D399") // Emerald ErrorColor = lipgloss.Color("#FB7185") // Rose WarningColor = lipgloss.Color("#FCD34D") // Soft Amber Dim = lipgloss.Color("#71717A") // Zinc 500 (Clean grey) White = lipgloss.Color("#F4F4F5") // Zinc 100 DimText = lipgloss.Color("#A1A1AA") // Zinc 400 FaintBorder = lipgloss.Color("#27272A") // Zinc 800 (Faint Border) )
Brand colors
var ( BrandStyle = lipgloss.NewStyle(). Foreground(PrimaryColor). Bold(true) SuccessStyle = lipgloss.NewStyle(). Foreground(SuccessColor). Bold(true) ErrorStyle = lipgloss.NewStyle(). Foreground(ErrorColor). Bold(true) WarningStyle = lipgloss.NewStyle(). Foreground(WarningColor). Bold(true) DimStyle = lipgloss.NewStyle(). Foreground(Dim) LabelStyle = lipgloss.NewStyle(). Foreground(DimText) ValueStyle = lipgloss.NewStyle(). Foreground(White). Bold(true) // Banner for init/welcome screens BannerStyle = lipgloss.NewStyle(). Foreground(PrimaryColor). Bold(true). MarginBottom(1) // Status key-value pair styling KeyStyle = lipgloss.NewStyle(). Foreground(DimText). Width(20) ValStyle = lipgloss.NewStyle(). Foreground(White) // Divider DividerStyle = lipgloss.NewStyle(). Foreground(Dim) )
Reusable styles
var CLIVersion = "dev"
CLIVersion is the version of the CLI tool, dynamically set on start.
Functions ¶
func ErrorWithSuggestions ¶ added in v1.4.0
ErrorWithSuggestions prints an error message and a bulleted list of helpful suggestions.
func RenderTable ¶
RenderTable returns a styled table as a string.
func Spinner ¶
Spinner runs fn inside a spinner with the given title. Returns any error from fn, or from the spinner itself.
func StatusRow ¶
func StatusRow(key, value string)
StatusRow prints a key-value pair for status output.
func StatusRowDim ¶
func StatusRowDim(key, value string)
StatusRowDim prints a key-value pair with dimmed value.
func SuccessWithSuggestions ¶ added in v1.4.0
SuccessWithSuggestions prints a success message and a list of next steps.
Types ¶
This section is empty.