ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Green  = "\033[32m"
	Red    = "\033[31m"
	Yellow = "\033[33m"
	Cyan   = "\033[36m"
	Blue   = "\033[34m"
	Dim    = "\033[2m"
	Bold   = "\033[1m"
	Reset  = "\033[0m"
)

ANSI color constants

Variables

This section is empty.

Functions

func Dimf

func Dimf(format string, args ...any)

Dimf prints a dim formatted message.

func Error

func Error(msg string)

Error prints a red error message to stderr.

func Fatalf

func Fatalf(format string, args ...any)

Fatalf prints an error and exits.

func Header(msg string)

Header prints a cyan bold header, only in TTY mode.

func IsTTY

func IsTTY() bool

IsTTY returns true if stdout is a terminal.

func ProgressBar

func ProgressBar(label string, current, total int)

ProgressBar renders an inline ASCII progress bar that overwrites itself.

[======>           ] 42% Extracting (12/30) Swift

func ProgressDone

func ProgressDone(msg string)

ProgressDone clears the progress line and prints a final summary.

func Status

func Status(msg string)

Status prints a green indented status line.

func Success

func Success(msg string)

Success prints a green success message.

func TermWidth

func TermWidth() int

TermWidth returns the terminal width, defaulting to 80.

func Waiting

func Waiting(msg string)

Waiting prints a yellow waiting message.

Types

type Spinner

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

Spinner displays an animated ASCII spinner with a label. Call Stop() to clear the line. Safe for concurrent use.

func NewSpinner

func NewSpinner(label string) *Spinner

NewSpinner starts a spinner with the given label.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop clears the spinner line.

func (*Spinner) Update

func (s *Spinner) Update(label string)

Update changes the spinner label.

Jump to

Keyboard shortcuts

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