Codebase list golang-github-vbauerster-mpb / f72b2a7
disable triggerComplete if initial total <= 0 Vladimir Bauer 5 years ago
1 changed file(s) with 5 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
105105 }
106106
107107 // Add creates a bar which renders itself by provided filler.
108 // Set total to 0, if you plan to update it later.
108 // If `total <= 0` trigger complete event is disabled until reset with *bar.SetTotal(int64, bool).
109109 // Panics if *Progress instance is done, i.e. called after *Progress.Wait().
110110 func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) *Bar {
111111 if filler == nil {
348348 debugOut: s.debugOut,
349349 }
350350
351 if total > 0 {
352 bs.triggerComplete = true
353 }
354
351355 for _, opt := range options {
352356 if opt != nil {
353357 opt(bs)