ui

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spinner

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

Spinner displays an animated progress indicator.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the spinner and clears its line.

type UI

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

UI provides styled terminal output.

func New

func New(out, errOut io.Writer) *UI

New creates a UI that writes to out and errOut. TTY detection is performed on out.

func (*UI) Dim

func (u *UI) Dim(msg string)

Dim prints dimmed text.

func (*UI) EndFrame

func (u *UI) EndFrame()

EndFrame prints a dimmed closing separator: " ---"

func (*UI) Error

func (u *UI) Error(msg string)

Error prints an error message: "error: msg" to errOut. Only the "error:" prefix is styled to prevent lipgloss from mangling multi-line message bodies.

func (*UI) Header

func (u *UI) Header(msg string)

Header prints a section header: "==> msg" in bold blue.

func (*UI) IsTTY

func (u *UI) IsTTY() bool

IsTTY reports whether the output is a terminal.

func (*UI) Keyval

func (u *UI) Keyval(key, value string)

Keyval prints a label-value pair: " label value" with bold fixed-width label.

func (*UI) StartFrame

func (u *UI) StartFrame(title string)

StartFrame prints a dimmed separator header: " --- title ---"

func (*UI) StartSpinner

func (u *UI) StartSpinner(msg string) *Spinner

StartSpinner begins an animated spinner with the given message. In non-TTY mode it prints the message once and returns immediately. Call Stop() to clear the spinner line.

func (*UI) StatusColor

func (u *UI) StatusColor(status string) string

StatusColor returns the status string colored green if "running", yellow otherwise.

func (*UI) Success

func (u *UI) Success(msg string)

Success prints a success message: " ✓ msg" in green (TTY) or " ok msg" (non-TTY).

func (*UI) Table

func (u *UI) Table(headers []string, rows [][]string)

Table prints a column-aligned table with bold headers.

Jump to

Keyboard shortcuts

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