progress

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PhaseOptions added in v0.3.0

type PhaseOptions struct {
	Label  string
	Total  int
	Unit   string
	Detail string
}

PhaseOptions describes one bounded or unbounded foreground operation.

type Renderer added in v0.3.0

type Renderer interface {
	Pause()
	Resume()
	WriteAbove(func())
	Close()
}

Renderer is the small terminal surface shared by phase and upload progress. WriteAbove serializes a durable message with clearing and redrawing a live terminal display.

type Reporter added in v0.3.0

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

Reporter renders one compact progress phase. It deliberately reports one stable unit chosen by its caller instead of inferring work from retries or dynamically split requests.

func NewReporter added in v0.3.0

func NewReporter(out io.Writer, isTTY bool, options PhaseOptions) *Reporter

NewReporter starts rendering immediately. Non-terminal output gets one durable start line and no per-item updates.

func (*Reporter) Advance added in v0.3.0

func (r *Reporter) Advance()

Advance records one completed caller-defined unit.

func (*Reporter) Clear added in v0.3.0

func (r *Reporter) Clear()

Clear removes transient terminal lines without closing the phase.

func (*Reporter) Close added in v0.3.0

func (r *Reporter) Close()

Close stops rendering and restores the cursor. It is safe to defer, call repeatedly, and use during panic cleanup.

func (*Reporter) Complete added in v0.3.0

func (r *Reporter) Complete()

Complete closes the phase and writes its one durable completion line.

func (*Reporter) FinishItem added in v0.3.0

func (r *Reporter) FinishItem(key string)

FinishItem removes a concurrent item after its caller has completed an attempted unit.

func (*Reporter) Pause added in v0.3.0

func (r *Reporter) Pause()

Pause clears the live display and restores the cursor while another phase owns the terminal. The spinner keeps time but cannot redraw until Resume.

func (*Reporter) Resume added in v0.3.0

func (r *Reporter) Resume()

Resume redraws a paused live display.

func (*Reporter) SetCurrent added in v0.3.0

func (r *Reporter) SetCurrent(item string)

SetCurrent sets the one context item used by serial phases.

func (*Reporter) SetDetail added in v0.3.0

func (r *Reporter) SetDetail(detail string)

SetDetail replaces the concise, caller-defined status detail.

func (*Reporter) StartItem added in v0.3.0

func (r *Reporter) StartItem(key, item string)

StartItem adds or updates an active concurrent item. Rendering is capped at three names so high OCR concurrency never expands the terminal layout.

func (*Reporter) Stopped added in v0.3.0

func (r *Reporter) Stopped()

Stopped closes the phase and writes the one durable cancellation line.

func (*Reporter) WriteAbove added in v0.3.0

func (r *Reporter) WriteAbove(write func())

WriteAbove clears a TTY display, runs write, and redraws under one reporter lock. It is used for warnings and durable output emitted during a phase.

type Spinner

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

Spinner advances frames on a fixed timer and triggers a render callback.

func NewSpinner

func NewSpinner(interval time.Duration, render func()) *Spinner

func (*Spinner) Frame

func (s *Spinner) Frame() rune

func (*Spinner) Stop

func (s *Spinner) Stop()

type UploadTracker added in v0.3.0

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

UploadTracker renders byte progress for one serial Gemini batch upload.

func NewUpload added in v0.3.0

func NewUpload(out io.Writer, isTTY bool, batchID, total int64) *UploadTracker

func (*UploadTracker) AddBytes added in v0.3.0

func (t *UploadTracker) AddBytes(count int)

AddBytes records bytes read from the local upload source. It does not imply that Gemini acknowledged those bytes.

func (*UploadTracker) Close added in v0.3.0

func (t *UploadTracker) Close()

Close stops rendering and restores the terminal. It is safe to call more than once, including from a deferred panic-safety cleanup.

func (*UploadTracker) Complete added in v0.3.0

func (t *UploadTracker) Complete()

func (*UploadTracker) Pause added in v0.3.0

func (t *UploadTracker) Pause()

Pause clears the live upload before another phase takes the terminal.

func (*UploadTracker) Resume added in v0.3.0

func (t *UploadTracker) Resume()

Resume redraws an upload paused for a nested phase.

func (*UploadTracker) Stopped added in v0.3.0

func (t *UploadTracker) Stopped()

func (*UploadTracker) WriteAbove added in v0.3.0

func (t *UploadTracker) WriteAbove(write func())

WriteAbove serializes a durable message with clearing and redrawing the terminal upload display.

Jump to

Keyboard shortcuts

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