ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorMode

type ColorMode int

ColorMode controls whether CLI output should use terminal colors.

const (
	// ColorAuto enables color only when output is connected to a TTY.
	ColorAuto ColorMode = iota
	// ColorAlways always enables color.
	ColorAlways
	// ColorNever always disables color.
	ColorNever
)

func ParseColorMode

func ParseColorMode(value string) (ColorMode, error)

ParseColorMode parses a user-provided color mode.

type UI

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

UI owns CLI output streams and color capability for rendering user-facing output.

func New

func New(stdout, stderr io.Writer, mode ColorMode, isTTY bool) *UI

New creates a UI with resolved color support.

func (*UI) Color

func (u *UI) Color() bool

Color reports whether color output is enabled.

func (*UI) Errf

func (u *UI) Errf(format string, a ...any)

Errf writes formatted output to stderr.

func (*UI) Errln

func (u *UI) Errln(args ...any)

Errln writes a line to stderr.

func (*UI) Outf

func (u *UI) Outf(format string, a ...any)

Outf writes formatted output to stdout.

func (*UI) Stderr

func (u *UI) Stderr() io.Writer

Stderr returns the configured standard error writer.

func (*UI) Stdout

func (u *UI) Stdout() io.Writer

Stdout returns the configured standard output writer.

Jump to

Keyboard shortcuts

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