pb

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizePrompt

func NormalizePrompt(prompt string) string

NormalizePrompt normalizes the prompt string.

func SetDisableProgress

func SetDisableProgress(disable bool)

SetDisableProgress disables the progress bar.

Types

type ProgressBar

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

ProgressBar is a progress bar.

func NewProgressBar

func NewProgressBar(writers ...io.Writer) *ProgressBar

NewProgressBar creates a new progress bar.

func (*ProgressBar) Abort

func (p *ProgressBar) Abort(name string, err error)

Abort aborts the progress bar.

func (*ProgressBar) Add

func (p *ProgressBar) Add(prompt, name string, size int64, reader io.Reader) io.Reader

Add adds a new progress bar.

func (*ProgressBar) Complete

func (p *ProgressBar) Complete(name string, msg string)

Complete completes the progress bar.

func (*ProgressBar) Get

func (p *ProgressBar) Get(name string) *progressBar

Get returns the progress bar.

func (*ProgressBar) Reset added in v0.2.3

func (p *ProgressBar) Reset(prompt, name string, size int64, reader io.Reader) io.Reader

Reset resets an existing progress bar for a new phase. Aborts the old bar (if any, see Add for completed-bar semantics) and creates a new one with updated prompt, reset progress, and fresh speed counter. Creates the bar if it does not exist yet. Parameter order matches Add.

func (*ProgressBar) Spinner added in v0.2.3

func (p *ProgressBar) Spinner(prompt, name string, size int64)

Spinner adds an indeterminate bar for a phase that transfers no bytes, such as a remote existence check. It renders a spinner, the prompt, the total size, and the elapsed time. It has no byte counter and no transfer rate, so a slow phase does not show a misleading "0 B / N B" and "0 B/s". Call Reset (or Add) with the same name to replace it with a transfer bar once bytes start flowing, or Complete / Abort to finish it.

func (*ProgressBar) Start

func (p *ProgressBar) Start()

Start starts the progress bar.

func (*ProgressBar) Stop

func (p *ProgressBar) Stop()

Stop waits for the progress bar to finish.

Jump to

Keyboard shortcuts

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