Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(p *ProgressBar)
Option is the type all options need to adhere to
func OptionSetRenderBlankState ¶
OptionSetRenderBlankState sets whether or not to render a 0% bar on construction
func OptionSetTheme ¶
OptionSetTheme sets the elements the bar is constructed of
func OptionSetWriter ¶
OptionSetWriter sets the output writer (defaults to os.StdOut)
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar is a thread-safe, simple progress bar
Example ¶
bar := NewOptions(100, OptionSetWidth(10), OptionSetRenderBlankState(false)) bar.Reset() time.Sleep(1 * time.Second) bar.Add(10)
Output: 10% |█ | [1s:9s]
func NewOptions ¶
func NewOptions(max int, options ...Option) *ProgressBar
NewOptions constructs a new instance of ProgressBar, with any options you specify
func (*ProgressBar) Add ¶
func (p *ProgressBar) Add(num int) error
Add with increase the current count on the progress bar
func (*ProgressBar) RenderBlank ¶
func (p *ProgressBar) RenderBlank() error
RenderBlank renders the current bar state, you can use this to render a 0% state
Example ¶
NewOptions(10, OptionSetWidth(10), OptionSetRenderBlankState(true))
Output: 0% | | [0s:0s]
func (*ProgressBar) Reset ¶
func (p *ProgressBar) Reset()
Reset will reset the clock that is used to calculate current time and the time left.
Click to show internal directories.
Click to hide internal directories.