diff --git a/progress.go b/progress.go index 08aab47..b81dd69 100644 --- a/progress.go +++ b/progress.go @@ -112,12 +112,15 @@ return p.New(total, SpinnerStyle(), options...) } -// New creates a bar which renders itself by `BarFiller`, which is obtained -// via provided `BarFillerBuilder`. If `total <= 0` triggering complete event -// by increment methods is disabled. Panics if *Progress instance is done, -// i.e. called after (*Progress).Wait(). +// New creates a bar with provided BarFillerBuilder. func (p *Progress) New(total int64, builder BarFillerBuilder, options ...BarOption) *Bar { - filler := builder.Build() + return p.Add(total, builder.Build(), options...) +} + +// Add creates a bar which renders itself by provided filler. +// If `total <= 0` triggering complete event by increment methods is disabled. +// Panics if *Progress instance is done, i.e. called after (*Progress).Wait(). +func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) *Bar { if filler == nil { filler = NopStyle().Build() }