示例#1
0
文件: barcli.go 项目: karlek/progress
// 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
}
示例#2
0
文件: barcli.go 项目: 0xC3/progress
// 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
}