Documentation
¶
Overview ¶
Package yanprogress provides Yet ANother Progressbar!
This is a simple one that provides a bar when the total value is known, or a spinner when it is not. It also detects whether the output device is a real tty. If it is not, then output is line by line suitable for log files or environments that capture the terminal streams e.g. containers or CI systems.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCursorPosition ¶
GetCursorPosition retrieves the cursor position
func WithWriter ¶
WithWriter sets the output stream for the bar (default os.Stderr)
Types ¶
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
func NewProgressBar ¶
func NewProgressBar(max uint64, redrawInterval time.Duration, opts ...optionFunc) *ProgressBar
NewProgressBar creates a new progress bar.
Set max to zero for an unbounded spinner, else it is the value that represents 100% complete.
func (*ProgressBar) Complete ¶
func (p *ProgressBar) Complete()
Complete marks the progress as complete and shows the cursor.
It also cancels the goroutine responsible for redrawing the bar.
func (*ProgressBar) Inc ¶
func (p *ProgressBar) Inc()
Inc increments the progress bar's value by one.
func (*ProgressBar) Pause ¶
func (p *ProgressBar) Pause()
Pause puases redrawing of the bar, e.g. to accept console input
func (*ProgressBar) Set ¶
func (p *ProgressBar) Set(value uint64)
Set sets the progress bar's value to a specific value.
func (*ProgressBar) SetStatus ¶
func (p *ProgressBar) SetStatus(status string)
SetStatus sets the status line for the progress bar.
Use this to indicate to users what is currently happening.
func (*ProgressBar) Start ¶
func (p *ProgressBar) Start()
Start hides the cursor and starts drawing the progress bar.