progressbar

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2017 License: MIT Imports: 7 Imported by: 240

README

progressbar
Build Status Code Coverage Go Report Card GoDoc

A very simple progress bar.

Basic usage:

bar := progressbar.New(100)
for i := 0; i < 100; i++ {
    bar.Add(1)
    time.Sleep(10 * time.Millisecond)
}

which looks like:

 100% |████████████████████████████████████████| [1s:0s]            

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressBar

type ProgressBar struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ProgressBar is a thread-safe, simple progress bar

func New

func New(max int) *ProgressBar

New returns a new ProgressBar with the specified maximum

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) Show

func (p *ProgressBar) Show() error

Show will print the current progress bar

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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