Documentation ¶
Index ¶
- type ProgressBar
- func (p *ProgressBar) Add(num int) error
- func (p *ProgressBar) Reset()
- func (p *ProgressBar) Set(num int) error
- func (p *ProgressBar) SetMax(num int)
- func (p *ProgressBar) SetSize(size int)
- func (p *ProgressBar) SetTheme(theme []string)
- func (p *ProgressBar) SetWriter(w io.Writer)
- func (p *ProgressBar) Show() error
- func (p *ProgressBar) String() string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressBar ¶
ProgressBar is a thread-safe, simple progress bar
Example ¶
bar := New(10) bar.SetMax(100) bar.SetSize(10) bar.Reset() time.Sleep(1 * time.Second) bar.Add(10)
Output: 10% |█ | [1s:9s]
func (*ProgressBar) Add ¶
func (p *ProgressBar) Add(num int) error
Add with increase the current count on the progress bar
func (*ProgressBar) Reset ¶
func (p *ProgressBar) Reset()
Reset will reset the clock that is used to calculate current time and the time left.
func (*ProgressBar) Set ¶
func (p *ProgressBar) Set(num int) error
Set will change the current count on the progress bar
func (*ProgressBar) SetMax ¶
func (p *ProgressBar) SetMax(num int)
SetMax sets the total number of the progress bar
func (*ProgressBar) SetSize ¶
func (p *ProgressBar) SetSize(size int)
SetSize sets the size of the progress bar.
func (*ProgressBar) SetTheme ¶ added in v0.5.0
func (p *ProgressBar) SetTheme(theme []string)
func (*ProgressBar) SetWriter ¶ added in v0.5.0
func (p *ProgressBar) SetWriter(w io.Writer)
SetWriter will specify a different writer than os.Stdout
func (*ProgressBar) Show ¶
func (p *ProgressBar) Show() error
Show will print the current progress bar
func (*ProgressBar) String ¶ added in v0.5.0
func (p *ProgressBar) String() string
Click to show internal directories.
Click to hide internal directories.