ui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ui centralizes all terminal output so the whole CLI speaks with one voice: plain language in the default view, technical detail behind verbose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UI

type UI struct {
	Out     io.Writer
	Err     io.Writer
	Verbose bool
	// Interactive is false when stdin is not a TTY (CI, pipes); prompts then
	// fall back to safe defaults instead of hanging.
	Interactive bool
	// AssumeYes (--yes) answers every confirmation with its default.
	AssumeYes bool
}

func New

func New(verbose, assumeYes bool) *UI

func (*UI) Bold

func (u *UI) Bold(s string) string

func (*UI) Confirm

func (u *UI) Confirm(question string, def bool) bool

Confirm asks a yes/no question. --yes and non-interactive sessions return def.

func (*UI) Detail

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

Detail prints technical detail only in verbose mode.

func (*UI) Fail

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

func (*UI) Faint

func (u *UI) Faint(s string) string

func (*UI) Green

func (u *UI) Green(s string) string

func (*UI) Info

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

func (*UI) Printf

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

func (*UI) Red

func (u *UI) Red(s string) string

func (*UI) Success

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

func (*UI) Warn

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

Warn and Fail go to stderr: `donkey apps | grep` must not swallow the very lines that say something is wrong.

Jump to

Keyboard shortcuts

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