Documentation
¶
Overview ¶
Package ui provides styled output helpers for CLI feedback using lipgloss. This file implements a spinner for long-running operations.
Package ui provides styled output helpers for CLI feedback using lipgloss. Colors are applied automatically when the writer is a TTY and stripped for pipes, CI, and direnv subprocesses.
Index ¶
- func Bold(w io.Writer, s string) string
- func Cyan(w io.Writer, s string) string
- func Error(w io.Writer, msg string)
- func Gray(w io.Writer, s string) string
- func Green(w io.Writer, s string) string
- func Header(w io.Writer, title string)
- func Info(w io.Writer, msg string)
- func Item(w io.Writer, key, value string)
- func List(w io.Writer, names []string)
- func Panel(w io.Writer, title, headline string, entries []PanelEntry, border bool)
- func Red(w io.Writer, s string) string
- func Success(w io.Writer, msg string)
- func Warn(w io.Writer, msg string)
- func Yellow(w io.Writer, s string) string
- type PanelEntry
- type Spinner
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Panel ¶
func Panel(w io.Writer, title, headline string, entries []PanelEntry, border bool)
Panel prints a summary to w. When border is true a rounded box with the title embedded in the top edge is drawn; otherwise a compact single-header line with indented key/source rows is printed. Colors are stripped automatically on non-TTY writers.
Types ¶
type PanelEntry ¶
type PanelEntry struct {
Key string // variable or item name
Value string // display value (may be empty)
Source string // origin URI, e.g. "bw://folder/item"; empty = literal
}
PanelEntry is a single key/source row shown inside a Panel call.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner provides animated progress feedback during long-running operations. Only renders to TTY outputs — silently suppressed for pipes, CI, and direnv.
Example ¶
ExampleSpinner demonstrates basic spinner usage. This shows how to display progress while an operation runs.
spinner := NewSpinner(os.Stderr, "Loading secrets from Bitwarden...")
spinner.Start()
// Simulate work
time.Sleep(2 * time.Second)
// Update the message
spinner.SetMessage("Processing items...")
time.Sleep(1 * time.Second)
// Stop the spinner
spinner.Stop()
func NewSpinner ¶
NewSpinner creates a spinner writing to w with the given initial message.
func (*Spinner) SetMessage ¶
SetMessage updates the displayed message. Thread-safe.