Documentation
¶
Overview ¶
Package ui is notenv's hand-rolled terminal UI: ANSI styling, prompts, an arrow-key select, and a spinner. Built on x/term raw mode, which is already a dependency, so it adds zero new supply-chain surface.
Styling honors NO_COLOR and TERM=dumb and disables itself off-TTY. All human-facing output goes to stderr; stdout stays reserved for data.
Index ¶
- Variables
- func Bold(s string) string
- func Confirm(label string, def bool) (bool, error)
- func Cyan(s string) string
- func Dim(s string) string
- func Failf(format string, a ...any)
- func Green(s string) string
- func Infof(format string, a ...any)
- func Input(label, def string) (string, error)
- func Interactive() bool
- func Notef(format string, a ...any)
- func Red(s string) string
- func Select(label string, options []Option) (int, error)
- func Spin(label string, fn func() error) error
- func Successf(format string, a ...any)
- func Warnf(format string, a ...any)
- func Yellow(s string) string
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanceled = errors.New("canceled")
ErrCanceled is returned when the user aborts a prompt (Esc, q, Ctrl-C).
Functions ¶
func Select ¶
Select renders an arrow-key picker on the controlling terminal and returns the chosen index. Keys: up/down (or k/j), Enter to choose, Esc/q/Ctrl-C to cancel (returns ErrCanceled). Without a usable raw-mode terminal it falls back to a numbered prompt.
Types ¶
Click to show internal directories.
Click to hide internal directories.