output

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconSuccess    = "✓"
	IconWarning    = "⚠"
	IconError      = "✗"
	IconInfo       = "ℹ"
	IconRunning    = "●"
	IconPending    = "○"
	IconArrow      = "→"
	IconBullet     = "•"
	IconCheck      = "✔"
	IconCross      = "✘"
	IconStar       = "★"
	IconDot        = "·"
	IconPipe       = "│"
	IconCorner     = "└"
	IconTee        = "├"
	IconDash       = "─"
	IconDoubleDash = "═"
)

Status icons

Variables

View Source
var (
	// Primary colors
	PrimaryColor   = lipgloss.Color("#7C3AED") // Purple
	SecondaryColor = lipgloss.Color("#06B6D4") // Cyan
	AccentColor    = lipgloss.Color("#F59E0B") // Amber

	// Status colors
	SuccessColor = lipgloss.Color("#10B981") // Green
	WarningColor = lipgloss.Color("#F59E0B") // Amber
	ErrorColor   = lipgloss.Color("#EF4444") // Red
	InfoColor    = lipgloss.Color("#3B82F6") // Blue

	// Neutral colors
	MutedColor      = lipgloss.Color("#6B7280") // Gray
	BackgroundColor = lipgloss.Color("#1F2937") // Dark gray
	BorderColor     = lipgloss.Color("#374151") // Medium gray
)

Theme colors for consistent styling

View Source
var (
	// Title styles
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(PrimaryColor).
				MarginBottom(1)

	SubtitleStyle = lipgloss.NewStyle().
					Foreground(SecondaryColor).
					Italic(true)

	// Status styles
	SuccessStyle = lipgloss.NewStyle().
					Foreground(SuccessColor).
					Bold(true)

	WarningStyle = lipgloss.NewStyle().
					Foreground(WarningColor).
					Bold(true)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(ErrorColor).
				Bold(true)

	InfoStyle = lipgloss.NewStyle().
				Foreground(InfoColor)

	MutedStyle = lipgloss.NewStyle().
				Foreground(MutedColor)

	// Box styles
	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(BorderColor).
				Padding(1, 2)

	HeaderBoxStyle = lipgloss.NewStyle().
					Border(lipgloss.DoubleBorder()).
					BorderForeground(PrimaryColor).
					Padding(0, 2).
					Bold(true)

	// Badge styles
	SuccessBadge = lipgloss.NewStyle().
					Background(SuccessColor).
					Foreground(lipgloss.Color("#FFFFFF")).
					Padding(0, 1).
					Bold(true)

	WarningBadge = lipgloss.NewStyle().
					Background(WarningColor).
					Foreground(lipgloss.Color("#000000")).
					Padding(0, 1).
					Bold(true)

	ErrorBadge = lipgloss.NewStyle().
				Background(ErrorColor).
				Foreground(lipgloss.Color("#FFFFFF")).
				Padding(0, 1).
				Bold(true)

	InfoBadge = lipgloss.NewStyle().
				Background(InfoColor).
				Foreground(lipgloss.Color("#FFFFFF")).
				Padding(0, 1).
				Bold(true)
)

Styled text helpers

View Source
var (
	ColorSuccess = color.New(color.FgGreen, color.Bold)
	ColorWarning = color.New(color.FgYellow, color.Bold)
	ColorError   = color.New(color.FgRed, color.Bold)
	ColorInfo    = color.New(color.FgBlue)
	ColorMuted   = color.New(color.FgHiBlack)
	ColorPrimary = color.New(color.FgMagenta, color.Bold)
	ColorCyan    = color.New(color.FgCyan)
)

Color print helpers using fatih/color for table compatibility

Functions

func Badge

func Badge(text, badgeType string) string

Badge returns a styled badge

func Banner(name, version, description string)

Banner prints an application banner

func Divider

func Divider(width int) string

Divider renders a horizontal divider

func Error

func Error(msg string)

Error prints an error message

func Errorf

func Errorf(format string, args ...interface{})

Errorf prints a formatted error message

func Header(msg string)

Header prints a header with box style

func Info

func Info(msg string)

Info prints an info message

func Infof

func Infof(format string, args ...interface{})

Infof prints a formatted info message

func KeyValue

func KeyValue(key, value string) string

KeyValue renders a key-value pair

func List

func List(items []string)

List prints a bulleted list

func Muted

func Muted(msg string)

Muted prints a muted/dim message

func Newline

func Newline()

Newline prints an empty line

func NumberedList

func NumberedList(items []string)

NumberedList prints a numbered list

func Panel

func Panel(title, content string) string

Panel renders a styled panel/box with content

func Print

func Print(msg string)

Print outputs a message

func Printf

func Printf(format string, args ...interface{})

Printf outputs a formatted message

func ProgressBar

func ProgressBar(current, total int, width int) string

ProgressBar renders a simple progress bar

func Section

func Section(title string) string

Section renders a section header

func SpinnerError

func SpinnerError(msg string)

SpinnerError stops spinner with error message

func SpinnerSuccess

func SpinnerSuccess(msg string)

SpinnerSuccess stops spinner with success message

func StartSpinner

func StartSpinner(msg string)

StartSpinner starts a spinner with message

func StatusIcon

func StatusIcon(status string) string

StatusIcon returns an icon based on status

func StatusRow

func StatusRow(component, status, details string) ([]string, []tablewriter.Colors)

StatusRow returns a colored row based on status

func StopSpinner

func StopSpinner()

StopSpinner stops the spinner

func SubSection

func SubSection(title string) string

SubSection renders a subsection header

func Subtitle

func Subtitle(msg string)

Subtitle prints a subtitle

func Success

func Success(msg string)

Success prints a success message

func Successf

func Successf(format string, args ...interface{})

Successf prints a formatted success message

func Summary

func Summary(title string, items map[string]string)

Summary prints a summary box

func Title

func Title(msg string)

Title prints a title

func Tree

func Tree(root string, children []string)

Tree prints items in a tree structure

func Warning

func Warning(msg string)

Warning prints a warning message

func Warningf

func Warningf(format string, args ...interface{})

Warningf prints a formatted warning message

Types

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer handles all CLI output

func NewPrinter

func NewPrinter() *Printer

NewPrinter creates a new Printer instance

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table represents a styled table

func NewTable

func NewTable(config TableConfig) *Table

NewTable creates a new styled table

func ResourceTable

func ResourceTable(title string, headers []string) *Table

ResourceTable creates a pre-configured resource table

func SimpleTable

func SimpleTable(headers []string) *Table

SimpleTable creates a borderless simple table

func StatusTable

func StatusTable(title string) *Table

StatusTable creates a pre-configured status table

func (*Table) AddColoredRow

func (t *Table) AddColoredRow(row []string, colors []tablewriter.Colors)

AddColoredRow adds a row with specific colors

func (*Table) AddRow

func (t *Table) AddRow(row []string)

AddRow adds a row to the table

func (*Table) Render

func (t *Table) Render()

Render renders the table to stdout

func (*Table) RenderTo

func (t *Table) RenderTo(w io.Writer)

RenderTo renders the table to the specified writer

type TableConfig

type TableConfig struct {
	Title       string
	Headers     []string
	ShowBorder  bool
	ShowRowLine bool
	Colored     bool
	Compact     bool
}

TableConfig holds configuration for table rendering

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL