Documentation
¶
Index ¶
- type ProgressBar
- func (pb *ProgressBar) Add(n int64)
- func (pb *ProgressBar) Additional(s string)
- func (pb *ProgressBar) Cancel()
- func (pb *ProgressBar) Done()
- func (pb *ProgressBar) FromReader(r io.Reader, w io.Writer) (int64, error)
- func (pb *ProgressBar) Message(msg string) error
- func (pb *ProgressBar) SetRefreshInterval(interval time.Duration) *ProgressBar
- func (pb *ProgressBar) SetRenderInterval(interval time.Duration) *ProgressBar
- func (pb *ProgressBar) SetTemplate(tmplt string) error
- func (pb *ProgressBar) SetUnit(unit string) *ProgressBar
- func (pb *ProgressBar) SetWidth(blockWidth int) *ProgressBar
- func (pb *ProgressBar) Start() error
- func (pb *ProgressBar) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressBar ¶
type ProgressBar 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(total int) *ProgressBar
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 New64 ¶
func New64(total int64) *ProgressBar
New64 returns a new ProgressBar with default options.
func (*ProgressBar) Add ¶
func (pb *ProgressBar) Add(n int64)
Add adds the specified amount to the progress bar.
func (*ProgressBar) Additional ¶ added in v0.1.77
func (pb *ProgressBar) Additional(s string)
Additional adds the specified string to the progress bar.
func (*ProgressBar) Done ¶
func (pb *ProgressBar) Done()
Done waits the progress bar finished. Same as ProgressBar.Wait().
func (*ProgressBar) FromReader ¶
FromReader starts the progress bar from a reader.
func (*ProgressBar) Message ¶ added in v0.1.80
func (pb *ProgressBar) Message(msg string) error
Message sets a message to be displayed on the progress bar.
func (*ProgressBar) SetRefreshInterval ¶ added in v0.1.80
func (pb *ProgressBar) SetRefreshInterval(interval time.Duration) *ProgressBar
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) SetRenderInterval ¶ added in v0.1.80
func (pb *ProgressBar) SetRenderInterval(interval time.Duration) *ProgressBar
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) SetTemplate ¶
func (pb *ProgressBar) SetTemplate(tmplt string) error
SetTemplate sets progress bar template.
func (*ProgressBar) SetUnit ¶
func (pb *ProgressBar) SetUnit(unit string) *ProgressBar
SetUnit sets progress bar unit. It panics if called after the progress bar has started.
func (*ProgressBar) SetWidth ¶
func (pb *ProgressBar) SetWidth(blockWidth int) *ProgressBar
SetWidth sets the progress bar block width. It panics if called after the progress bar has started or if blockWidth is less than or equal to zero.
func (*ProgressBar) Wait ¶ added in v0.1.80
func (pb *ProgressBar) Wait()
Wait blocks until the progress bar is finished.