func (p *ProgressBar) Reset() {
	p.lock.Lock()
	defer p.lock.Unlock()
	p.state = getBlankState()
}
Reset will reset the clock that is used
to calculate current time and the time left.
package progressbar
import (
	"errors"
	"fmt"
	"io"
	"os"
	"regexp"
	"strings"
	"sync"
	"time"
	"github.com/mitchellh/colorstring"
)
type ProgressBar struct {
	state  state
	config config
	lock sync.Mutex
}
type State struct {
	CurrentPercent float64
	CurrentBytes   float64
	MaxBytes       int64
	SecondsSince   float64
	SecondsLeft    float64
	KBsPerSecond   float64
}
type state struct {
	currentNum        int64
	currentPercent    int
	lastPercent       int
	currentSaucerSize int
	lastShown time.Time
	startTime time.Time
	maxLineWidth int
	currentBytes float64
	finished bool
}
type config struct {
	max                  int64  
	width                int
	writer               io.Writer
	theme                Theme
	renderWithBlankState bool
	description          string
	colorCodes bool
	maxBytes   int64
	showIterationsPerSecond bool
	showIterationsCount     bool
	throttleDuration time.Duration
	clearOnFinish bool
}
type Theme struct {
	Saucer        string
	SaucerHead    string
	SaucerPadding string
	BarStart      string
	BarEnd        string
}
type Option func(p *ProgressBar)
func OptionSetWidth(s int) Option {
	return func(p *ProgressBar) {
		p.config.width = s
	}
}
func OptionSetTheme(t Theme) Option {
	return func(p *ProgressBar) {
		p.config.theme = t
	}
}
func OptionSetWriter(w io.Writer) Option {
	return func(p *ProgressBar) {
		p.config.writer = w
	}
}
func OptionSetRenderBlankState(r bool) Option {
	return func(p *ProgressBar) {
		p.config.renderWithBlankState = r
	}
}
func OptionSetDescription(description string) Option {
	return func(p *ProgressBar) {
		p.config.description = description
	}
}
func OptionEnableColorCodes(colorCodes bool) Option {
	return func(p *ProgressBar) {
		p.config.colorCodes = colorCodes
	}
}
func OptionSetBytes(maxBytes int) Option {
	return OptionSetBytes64(int64(maxBytes))
}
func OptionSetBytes64(maxBytes int64) Option {
	return func(p *ProgressBar) {
		p.config.maxBytes = maxBytes
	}
}
func OptionShowCount() Option {
	return func(p *ProgressBar) {
		p.config.showIterationsCount = true
	}
}
func OptionShowIts() Option {
	return func(p *ProgressBar) {
		p.config.showIterationsPerSecond = true
	}
}
func OptionThrottle(duration time.Duration) Option {
	return func(p *ProgressBar) {
		p.config.throttleDuration = duration
	}
}
func OptionClearOnFinish() Option {
	return func(p *ProgressBar) {
		p.config.clearOnFinish = true
	}
}
var defaultTheme = Theme{Saucer: "█", SaucerPadding: " ", BarStart: "|", BarEnd: "|"}
func NewOptions(max int, options ...Option) *ProgressBar {
	return NewOptions64(int64(max), options...)
}
func NewOptions64(max int64, options ...Option) *ProgressBar {
	b := ProgressBar{
		state: getBlankState(),
		config: config{
			writer:           os.Stdout,
			theme:            defaultTheme,
			width:            40,
			max:              max,
			throttleDuration: 0 * time.Nanosecond,
		},
	}
	for _, o := range options {
		o(&b)
	}
	if b.config.renderWithBlankState {
		b.RenderBlank()
	}
	return &b
}
func getBlankState() state {
	now := time.Now()
	return state{
		startTime: now,
		lastShown: now,
	}
}
func New(max int) *ProgressBar {
	return NewOptions(max)
}
func (p *ProgressBar) RenderBlank() error {
	return p.render()
}