Documentation
¶
Index ¶
- type ProgressBar
- func (pb *ProgressBar[T]) Add(n T)
- func (pb *ProgressBar[T]) Additional(s string)
- func (pb *ProgressBar[T]) Cancel()
- func (pb *ProgressBar[T]) FromReader(r io.Reader, w io.Writer) (int64, error)
- func (pb *ProgressBar[T]) Message(msg string) error
- func (pb *ProgressBar[T]) SetRefreshInterval(interval time.Duration) *ProgressBar[T]
- func (pb *ProgressBar[T]) SetRenderInterval(interval time.Duration) *ProgressBar[T]
- func (pb *ProgressBar[T]) SetTemplate(tmplt string) error
- func (pb *ProgressBar[T]) SetUnit(unit string) *ProgressBar[T]
- func (pb *ProgressBar[T]) SetWidth(blockWidth int) *ProgressBar[T]
- func (pb *ProgressBar[T]) Start() error
- func (pb *ProgressBar[T]) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressBar ¶
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]) FromReader ¶
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.