Esempio n. 1
0
// New returns a new Bar object initialized from the given parameters and prints
// the bar.
func New(max int) (bar *Bar, err error) {
	bar = new(Bar)
	bar.backend, err = progress.New(max)
	if err != nil {
		return nil, err
	}
	bar.begin = time.Now()
	return bar, nil
}
Esempio n. 2
0
// New returns a new Bar object initialized from the given parameters and prints
// the bar.
func New(max int) (bar *Bar, err error) {
	bar = new(Bar)
	bar.backend, err = progress.New(max)
	if err != nil {
		return nil, err
	}
	err = bar.Print()
	if err != nil {
		return nil, err
	}
	return bar, nil
}