ui

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ui provides terminal UI components for the work CLI. All visual output targets stderr to keep stdout clean for shell eval.

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 provides an animated terminal spinner that writes to stderr. A nil *Spinner is safe to call methods on — all methods are no-ops, which makes it easy to suppress spinners for sh- commands.

func NewSpinner

func NewSpinner(suppressed bool) *Spinner

NewSpinner creates a spinner that animates on stderr. If suppressed is true, returns nil (all methods become no-ops). Use suppressed=true for sh- commands where stdout must stay clean.

func (*Spinner) ProgressFunc

func (s *Spinner) ProgressFunc() func(string)

ProgressFunc returns a function compatible with cache.ProgressFunc that updates the spinner's message. Returns nil if the spinner is nil.

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation. It blocks until Stop is called, so launch it in a goroutine:

go spinner.Start()

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the spinner and waits for the animation loop to exit. The spinner clears itself from the terminal on stop.

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(msg string)

UpdateMessage changes the spinner's status text. Safe for concurrent use from multiple goroutines.

Jump to

Keyboard shortcuts

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