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

progress

package
v1.233.0 Latest Latest
Warning

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

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

Documentation

Overview

Package progress shows what an AI request is doing.

It wraps the shared spinner so that provider tool events ("Running `atmos list stacks`…") update the spinner text, and so the spinner steps aside while an approval prompt owns the terminal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Indicator

type Indicator interface {
	Start()
	Stop()
	Update(message string)
	SetInterruptHandler(handler func())
}

Indicator is the subset of the spinner used by Progress. It is satisfied by *spinner.Spinner.

type Progress

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

Progress drives a spinner for the lifetime of one AI request. All methods are safe for concurrent use.

func New

func New(message string) *Progress

New creates Progress that shows message while the AI is thinking.

func (*Progress) Attach

func (p *Progress) Attach(target any) bool

Attach subscribes Progress to a provider's events when the provider reports them. It reports whether the provider does.

func (*Progress) Handle

func (p *Progress) Handle(event approval.Event)

Handle reflects a provider progress event in the spinner text.

func (*Progress) OnInterrupt

func (p *Progress) OnInterrupt(handler func())

OnInterrupt registers a function that runs when the user presses ctrl+c while the spinner is showing. Call it before Start. Pausing for a prompt is not an interrupt.

func (*Progress) Pause

func (p *Progress) Pause()

Pause hides the spinner so a prompt can use the terminal. It does nothing when the spinner is not showing.

func (*Progress) PromptHooks

func (p *Progress) PromptHooks() (before, after func())

PromptHooks returns functions to call immediately before and after a prompt is shown.

func (*Progress) Resume

func (p *Progress) Resume()

Resume shows the spinner again after Pause. It does nothing after Stop.

func (*Progress) Start

func (p *Progress) Start()

Start shows the spinner. In output that cannot animate it emits the message once as a status line.

func (*Progress) Stop

func (p *Progress) Stop()

Stop removes the spinner. It is idempotent.

Jump to

Keyboard shortcuts

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