Help us shape the future of Go! Take the 2026 Go Developer Survey

ui

package
v0.10.18 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorMap = map[string]lipgloss.Color{
	"black":   lipgloss.Color("#000000"),
	"red":     lipgloss.Color("#FF0000"),
	"green":   lipgloss.Color("#00FF00"),
	"yellow":  lipgloss.Color("#FFFF00"),
	"blue":    lipgloss.Color("#0000FF"),
	"magenta": lipgloss.Color("#FF00FF"),
	"cyan":    lipgloss.Color("#00FFFF"),
	"white":   lipgloss.Color("#FFFFFF"),
}

ColorMap maps color names to their lipgloss.Color values

Functions

func GetLipglossColor

func GetLipglossColor(col string) (lipgloss.Color, error)

GetLipglossColor converts a color string to a lipgloss.Color

func NewCheckPrinter

func NewCheckPrinter(opts ...checkmate.Option) *checkmate.Printer

NewCheckPrinter creates a new checkmate.Printer configured for this project. Use this for check-style output (validations, quality checks, build steps).

Example:

p := ui.NewCheckPrinter()
p.CategoryHeader("Code Quality")
p.CheckHeader("Running linter")
p.CheckSuccess("No issues found")

func NewCheckPrinterWithWriter

func NewCheckPrinterWithWriter(w io.Writer, opts ...checkmate.Option) *checkmate.Printer

NewCheckPrinterWithWriter creates a checkmate.Printer that writes to the specified writer.

func PrintColoredMessage

func PrintColoredMessage(out io.Writer, message, col string) error

PrintColoredMessage prints a message to the console with a specific color

func RenderError

func RenderError(out io.Writer, friendlyMessage string, err error) error

RenderError prints an error message to the writer (stderr usually) and logs the full error.

Stream 2 (Status): Prints friendly error to out Stream 3 (Audit): Logs full error with stack trace to file

func RenderSuccess

func RenderSuccess(out io.Writer, message string, data interface{}) error

RenderSuccess prints a success message to the writer (stdout) and shadows it to the log file.

Stream 1 (Data): Prints formatted message to out Stream 3 (Audit): Logs raw data to file

func StderrCheckPrinter

func StderrCheckPrinter() *checkmate.Printer

StderrCheckPrinter returns a checkmate.Printer that writes to stderr.

func StdoutCheckPrinter

func StdoutCheckPrinter() *checkmate.Printer

StdoutCheckPrinter returns a checkmate.Printer that writes to stdout. This is a convenience for the common case.

Types

type DefaultUIRunner

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

DefaultUIRunner is the default implementation of UIRunner

func NewDefaultUIRunner

func NewDefaultUIRunner() *DefaultUIRunner

NewDefaultUIRunner creates a new DefaultUIRunner with the standard program factory

func NewTestUIRunner

func NewTestUIRunner() *DefaultUIRunner

For testing only - allows creating a DefaultUIRunner with a nil program factory This simulates a successful UI run without actually creating a tea.Program

func (*DefaultUIRunner) RunUI

func (d *DefaultUIRunner) RunUI(message, col string) error

RunUI runs the Bubble Tea UI

type MockUIRunner

type MockUIRunner struct {
	CalledWithMessage string
	CalledWithColor   string
	ReturnError       error
}

MockUIRunner is a mock implementation of the UIRunner interface for testing

func (*MockUIRunner) RunUI

func (m *MockUIRunner) RunUI(message, col string) error

type UIRunner

type UIRunner interface {
	RunUI(message, col string) error
}

UIRunner defines an interface for running a UI

Jump to

Keyboard shortcuts

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