Documentation
¶
Index ¶
- type Option
- func OptionEnableColorCodes(colorCodes bool) Option
- func OptionFullWidth() Option
- func OptionOnCompletion(cmpl func()) Option
- func OptionSetDescription(description string) Option
- func OptionSetRenderBlankState(r bool) Option
- func OptionSetTheme(t Theme) Option
- func OptionSetWidth(width int) Option
- func OptionSetWriter(w io.Writer) Option
- func OptionShowBytes(val bool) Option
- func OptionShowCount() Option
- func OptionSpinnerType(spinnerType int) Option
- func OptionThrottle(duration time.Duration) Option
- type ProgressBar
- type State
- type Theme
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 OptionEnableColorCodes ¶
OptionEnableColorCodes enables or disables support for color codes using mitchellh/colorstring
func OptionOnCompletion ¶
func OptionOnCompletion(cmpl func()) Option
OptionOnCompletion will invoke cmpl function once its finished
func OptionSetDescription ¶
OptionSetDescription sets the description of the bar to render in front of it
func OptionSetRenderBlankState ¶
OptionSetRenderBlankState sets whether to render a 0% bar on construction
func OptionSetTheme ¶
OptionSetTheme sets the elements the bar is constructed of
func OptionSetWidth ¶
OptionSetWidth sets the width of the bar
func OptionSetWriter ¶
OptionSetWriter sets the output writer (defaults to os.Stdout)
func OptionShowBytes ¶
OptionShowBytes will update the progress bar configuration settings to display/hide KBytes/Sec
func OptionShowCount ¶
func OptionShowCount() Option
OptionShowCount will also print current count out of total
func OptionSpinnerType ¶
OptionSpinnerType sets the type of spinner used for indeterminate bars
func OptionThrottle ¶
OptionThrottle will wait the specified duration before updating again. The default duration is 0 seconds.
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
func Default ¶
func Default(max int64, description ...string) *ProgressBar
Default provides a progress bar with recommended defaults. Set max to -1 to use as a spinner.
func NewOptions64 ¶
func NewOptions64(max int64, options ...Option) *ProgressBar
func (*ProgressBar) Add ¶
func (p *ProgressBar) Add(num int) error
Add will add the specified amount to the progress bar
func (*ProgressBar) Add64 ¶
func (p *ProgressBar) Add64(num int64) error
Add64 will add the specified amount to 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
func (*ProgressBar) String ¶
func (p *ProgressBar) String() string
String returns the current rendered version of the progress bar. It will never return an empty string while the progress bar is running.