ui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes added in v0.8.0

func FormatBytes(b int64) string

FormatBytes returns a human-readable byte size (e.g., "1.2 GB").

Types

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) 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) Keyval

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

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

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