Help us shape the future of Go! Take the 2026 Go Developer Survey

spinner

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package spinner provides a simple terminal spinner backed by Bubble Tea.

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 runs a spinner animation while a function executes, then prints a final message when done. Use New to create one, configure with With* methods, and call Run to execute.

func New

func New() *Spinner

New returns a Spinner with sensible defaults writing to stderr.

func (*Spinner) Run

func (s *Spinner) Run(fn func() error) error

Run executes fn, showing the spinner while it runs. The spinner is skipped when disabled or when the output is not a TTY. Returns any error from fn.

func (*Spinner) WithDisabled

func (s *Spinner) WithDisabled(v bool) *Spinner

WithDisabled disables the spinner entirely when v is true. fn still runs, but no animation or final message is shown.

func (*Spinner) WithFinalMsg

func (s *Spinner) WithFinalMsg(msg string) *Spinner

WithFinalMsg sets the line printed after fn completes.

func (*Spinner) WithLabel

func (s *Spinner) WithLabel(label string) *Spinner

WithLabel sets the text shown next to the spinner frame.

func (*Spinner) WithOutput

func (s *Spinner) WithOutput(w io.Writer) *Spinner

WithOutput sets the writer the spinner renders to (default: os.Stderr).

func (*Spinner) WithStyle

func (s *Spinner) WithStyle(style lipgloss.Style) *Spinner

WithStyle sets the lipgloss style applied to the spinner frame.

Jump to

Keyboard shortcuts

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