progress

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package progress renders determinate progress for long, countable operations (e.g. --all pagination): an in-place count line on an interactive terminal, or newline-delimited JSON page_fetch events when piped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode int

Mode selects how a Reporter renders.

const (
	Silent      Mode = iota // emit nothing (e.g. --quiet)
	Interactive             // in-place count line on a TTY
	Events                  // NDJSON page_fetch events (piped / --no-color)
)

type Reporter

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

Reporter renders determinate progress to w.

func New

func New(w io.Writer, mode Mode) *Reporter

New returns a Reporter writing to w in the given mode.

func (*Reporter) Stop

func (r *Reporter) Stop()

Stop finalizes the reporter. In interactive mode it clears the in-place line. Stop is idempotent: subsequent calls after the first are no-ops.

func (*Reporter) Update

func (r *Reporter) Update(fetched, total int)

Update reports that fetched items of total have been retrieved. total <= 0 means the total is unknown.

Jump to

Keyboard shortcuts

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