cli

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cli holds presentation helpers shared by Cobra commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

Spinner renders a single-line "in-progress" indicator on stderr while long-running steps run in the background. It auto-disables when stderr is not a terminal or when NO_COLOR is set, so piped/CI output stays clean.

Lifecycle:

sp := cli.NewSpinner("starting…")
defer sp.Stop()
sp.Update("searching…")
sp.Update("thinking…")

func NewSpinner

func NewSpinner(initial string) *Spinner

NewSpinner starts a spinner with the given initial label. Always call Stop() to clear the line and release the goroutine.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop clears the spinner line and waits for the rendering goroutine to finish. Idempotent — safe to call from a defer even if the spinner was never enabled.

func (*Spinner) Update

func (s *Spinner) Update(label string)

Update changes the label text shown next to the spinner frame. Safe to call from any goroutine. No-op once Stop() has been called.

Jump to

Keyboard shortcuts

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