progress

package
v4.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressBars

type ProgressBars struct {
	// Writer can be set to direct where progress bars are printed
	// os.Stdout is used by default
	Writer io.Writer

	// Width specifies the overall width of the progress bars display.
	// 80 is used by default
	Width int

	// RefreshRate controls the frequency of updates being pushed to the
	// screen.
	// 1 second is the default
	RefreshRate time.Duration
	// contains filtered or unexported fields
}

ProgressBars is the primary interface into the package. codebeat:disable[TOO_MANY_IVARS]

func New

func New() *ProgressBars

New provisions a new ProgressBars struct with default values

func (*ProgressBars) AddBar

func (p *ProgressBars) AddBar(action, name string) *ProgressBars

AddBar adds a progress bar to the ProgressBars struct. The action and name are used to print status information when the progress bars are started, Because this package is designed to work in non-tty settings where re-painting screens doesn't work we cannot dynamically add new progress bars, so this method panics if the ProgressBars is currently running when invoked.

func (*ProgressBars) Done

func (p *ProgressBars) Done(barName string)

Done terminates a single progress bar by name in a successful state

func (*ProgressBars) Error

func (p *ProgressBars) Error(barName string)

Done terminates a single progress bar by name in a failure state

func (*ProgressBars) Start

func (p *ProgressBars) Start()

Start prints a state header defining the progress bars and then begins printing the bars themselves. It will continue printing until every bar is finished or Stop() is called.

func (*ProgressBars) Stop

func (p *ProgressBars) Stop()

Stop ends the printing of all progress bars. Because Stop() is often called immediately after a call to Done() or Error() we do a final status update before actually doing a stop to flush those messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL