Documentation
¶
Overview ¶
Package ui provides terminal styling, hyperlinks, and a progress spinner. Colors are emitted as plain ANSI escapes, gated on a TTY check — nothing here queries the terminal, so there is no startup latency.
Index ¶
- func Banner(s string) string
- func Bold(s string) string
- func Cyan(s string) string
- func Dim(s string) string
- func Green(s string) string
- func IsStdoutTTY() bool
- func Link(text, url string) string
- func Red(s string) string
- func SelectGrouped(title string, items []SelectItem) (selected []int, ok bool, err error)
- func Underline(s string) string
- func Yellow(s string) string
- type SelectItem
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStdoutTTY ¶
func IsStdoutTTY() bool
IsStdoutTTY reports whether stdout is an interactive terminal.
func Link ¶
Link wraps text in an OSC 8 terminal hyperlink (zero visible width) when stdout is a TTY; otherwise returns plain text.
func SelectGrouped ¶
func SelectGrouped(title string, items []SelectItem) (selected []int, ok bool, err error)
SelectGrouped shows an interactive grouped multi-select. Items must be ordered so that members of the same group are contiguous; a header row is rendered per group, and toggling it selects or deselects every item in that group.
Returns the indices of selected items (into items). ok is false if the user aborted (esc/q/ctrl+c). Implemented with raw terminal mode + the alternate screen (rather than a TUI framework that probes the terminal at startup), with a scrolling viewport so lists taller than the terminal work correctly.
Types ¶
type SelectItem ¶
type SelectItem struct {
Group string // group label (e.g. workflow file)
Label string // display label for the item
}
SelectItem is one selectable row belonging to a group.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is a progress indicator that animates only on a TTY. On a non-TTY it is silent until Stop prints the final message once.
func NewSpinner ¶
NewSpinner starts a spinner with the given initial message (animated on a TTY).