Documentation
¶
Index ¶
- func ActionableError(streams domain.IOStreams, message string, command string)
- func Bold(text string) string
- func ColorEnabled(streams domain.IOStreams) bool
- func Confirm(streams domain.IOStreams, message string) error
- func Dim(text string) string
- func Error(text string) string
- func IsTerminal(streams domain.IOStreams) bool
- func List(streams domain.IOStreams, items []ListItem, prompt string) (int, error)
- func PrintLogo(streams domain.IOStreams)
- func Progress(streams domain.IOStreams, current, total int, label string)
- func Prompt(streams domain.IOStreams, question string, defaultVal string) (string, error)
- func ResetColorFromEnv()
- func SaveAndDisableColor() func()
- func SetColorEnabled(enabled bool)
- func Success(text string) string
- func Verb(streams domain.IOStreams, verb string, message string)
- func VerbDelete(streams domain.IOStreams, message string)
- func Warning(text string) string
- type ListItem
- type Renderer
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionableError ¶
func ColorEnabled ¶
func IsTerminal ¶
IsTerminal returns false for non-file streams (e.g., pipes, test buffers). This is intentional: non-interactive contexts should not prompt for input.
func List ¶
List displays a numbered list on stderr and reads selection from stdin. If items > 15, truncates with "... and N more. Refine your search." Returns the selected index (0-based). In non-TTY mode: prints list to stdout (parseable), returns -1 (no selection).
func ResetColorFromEnv ¶
func ResetColorFromEnv()
ResetColorFromEnv re-reads the NO_COLOR environment variable and updates the color flag accordingly. Call this in tests after t.Setenv("NO_COLOR", ...) to simulate the env-based initialization that init() performs once at startup.
func SaveAndDisableColor ¶
func SaveAndDisableColor() func()
SaveAndDisableColor saves the current color state, disables color output, and returns a restore function that sets colorFlag back to the saved state. Usage in tests: restore := ui.SaveAndDisableColor(); defer restore()
func SetColorEnabled ¶
func SetColorEnabled(enabled bool)
func VerbDelete ¶
Types ¶
type ListItem ¶
type ListItem struct {
Type string // "decision", "feature", etc.
Title string // slug or heading
Date string // "2026-03-07"
}
ListItem represents one entry in a numbered selection list.
type Renderer ¶
type Renderer interface {
Progress(current, total int, label string)
QuestionConfirm(label, value string)
Result(verb, filename string)
}
Renderer defines the contract for question flow rendering. Two implementations exist:
- ProgressRenderer (TTY): condensation progressive, bar, checkmarks, ANSI colors
- LineRenderer (non-TTY): one line per event, no ANSI rewriting, CI/pipe compatible
Current implementations live in workflow/ (ProgressRenderer and LineRenderer). TODO: migrate workflow.ProgressRenderer and workflow.LineRenderer here post-MVP.
type Spinner ¶ added in v1.1.0
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays an animated spinner with a label, elapsed time, and optional timeout countdown on stderr.
func StartSpinner ¶ added in v1.1.0
StartSpinner begins a spinner animation with the given label. Shows elapsed time: ⠹ Label… (12s)
func StartSpinnerWithTimeout ¶ added in v1.1.0
func StartSpinnerWithTimeout(streams domain.IOStreams, label string, timeout time.Duration) *Spinner
StartSpinnerWithTimeout begins a spinner that also shows a countdown to the configured timeout and warns when 80% has elapsed.
func (*Spinner) Stop ¶ added in v1.1.0
func (s *Spinner) Stop()
Stop halts the spinner and clears the line.
func (*Spinner) StopWith ¶ added in v1.1.0
StopWith halts the spinner and prints a final message on the same line.
func (*Spinner) StopWithDuration ¶ added in v1.1.0
StopWithDuration halts the spinner and prints a message with elapsed time.