progressbar

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressBar

type ProgressBar[T int | int64] struct {
	// contains filtered or unexported fields
}

ProgressBar represents a customizable progress bar for tracking task progress. It supports configurable templates, units, and refresh intervals.

func New

func New[T int | int64](total T) *ProgressBar[T]

New creates a new ProgressBar with the specified total count and default options. It panics if total is less than or equal to zero.

func (*ProgressBar[T]) Add

func (pb *ProgressBar[T]) Add(n T)

Add adds the specified amount to the progress bar.

func (*ProgressBar[T]) Additional added in v0.1.77

func (pb *ProgressBar[T]) Additional(s string)

Additional adds the specified string to the progress bar.

func (*ProgressBar[T]) Cancel

func (pb *ProgressBar[T]) Cancel()

Cancel cancels the progress bar.

func (*ProgressBar[T]) FromReader

func (pb *ProgressBar[T]) FromReader(r io.Reader, w io.Writer) (int64, error)

FromReader starts the progress bar from a reader.

func (*ProgressBar[T]) Message added in v0.1.80

func (pb *ProgressBar[T]) Message(msg string) error

Message sets a message to be displayed on the progress bar.

func (*ProgressBar[T]) SetRefreshInterval added in v0.1.80

func (pb *ProgressBar[T]) SetRefreshInterval(interval time.Duration) *ProgressBar[T]

SetRefreshInterval sets progress bar refresh interval time for check speed. It panics if called after the progress bar has started or if interval is less than or equal to zero.

func (*ProgressBar[T]) SetRenderInterval added in v0.1.80

func (pb *ProgressBar[T]) SetRenderInterval(interval time.Duration) *ProgressBar[T]

SetRenderInterval sets the interval for updating the progress bar display. It panics if called after the progress bar has started or if interval is less than or equal to zero.

func (*ProgressBar[T]) SetTemplate

func (pb *ProgressBar[T]) SetTemplate(tmplt string) error

SetTemplate sets progress bar template.

func (*ProgressBar[T]) SetUnit

func (pb *ProgressBar[T]) SetUnit(unit string) *ProgressBar[T]

SetUnit sets progress bar unit.

func (*ProgressBar[T]) SetWidth

func (pb *ProgressBar[T]) SetWidth(blockWidth int) *ProgressBar[T]

SetWidth sets the progress bar block width. It panics if blockWidth is less than or equal to zero.

func (*ProgressBar[T]) Start

func (pb *ProgressBar[T]) Start() error

Start starts the progress bar.

func (*ProgressBar[T]) Wait added in v0.1.80

func (pb *ProgressBar[T]) Wait()

Wait blocks until the progress bar is finished.

Jump to

Keyboard shortcuts

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