spinner

package
v0.27.7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: CC0-1.0 Imports: 9 Imported by: 0

Documentation

Overview

Package spinner provides a Bubble Tea progress display for `prosa sync`. The view is compact and fixed-height: one header, one found-summary, two phase rows, one current line, and up to 5 rolling error blocks. View() runs in O(K) where K = visible error slots — independent of N.

Callers outside an interactive TTY must NOT call Run — sync.go gates on cli.IsInteractive() and falls back to slog-linear output instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, items []Item, updates <-chan Update, opts Options) error

Run blocks until all phases finish or the updates channel is closed. Does not use the alternate screen so the final frame remains visible after exit.

Types

type Item

type Item struct {
	Agent string
	Path  string
}

Item describes one session about to be imported or reconciled.

type Options

type Options struct {
	// Title prints on the very top line (defaults to "prosa sync · local store").
	Title string
	// Banner is a free-form fragment displayed after Title (legacy bundle path).
	Banner string
	// Found summarizes discovered work per agent. Optional.
	Found string
	// RemoteEnabled shows the remote catch-up row and waits for it before quit.
	RemoteEnabled bool
}

Options tune the compact view's framing.

type Phase

type Phase int

Phase identifies which sync stage an Update applies to.

const (
	PhaseLocal Phase = iota
	PhaseRemote
)

type Update

type Update struct {
	Phase Phase

	Begin       bool
	Total       int
	Verb        string
	SetTotal    bool
	Done        bool
	Extra       string
	Unavailable bool

	Index   int
	Started bool
	Skipped bool
	Err     error

	// Active sets the current line for the given phase without bumping counters.
	Active *Item
}

Update is produced by the sync driver goroutine for lifecycle events and per-item progress.

Jump to

Keyboard shortcuts

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