*Progress.New to create bars with BarFillerBuilder directly
Vladimir Bauer
4 years ago
| 98 | 98 | return p |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | // AddBar creates a bar with default bar filler. Different filler can | |
| 102 | // be chosen and applied via `*Progress.Add(...) *Bar` method. | |
| 101 | // AddBar creates a bar with default bar filler. | |
| 103 | 102 | func (p *Progress) AddBar(total int64, options ...BarOption) *Bar { |
| 104 | return p.Add(total, NewBarFiller(BarStyle()), options...) | |
| 105 | } | |
| 106 | ||
| 107 | // AddSpinner creates a bar with default spinner filler. Different | |
| 108 | // filler can be chosen and applied via `*Progress.Add(...) *Bar` | |
| 109 | // method. | |
| 103 | return p.New(total, BarStyle(), options...) | |
| 104 | } | |
| 105 | ||
| 106 | // AddSpinner creates a bar with default spinner filler. | |
| 110 | 107 | func (p *Progress) AddSpinner(total int64, options ...BarOption) *Bar { |
| 111 | return p.Add(total, NewBarFiller(SpinnerStyle()), options...) | |
| 108 | return p.New(total, SpinnerStyle(), options...) | |
| 109 | } | |
| 110 | ||
| 111 | // New creates a bar with provided BarFillerBuilder. | |
| 112 | func (p *Progress) New(total int64, builder BarFillerBuilder, options ...BarOption) *Bar { | |
| 113 | return p.Add(total, builder.Build(), options...) | |
| 112 | 114 | } |
| 113 | 115 | |
| 114 | 116 | // Add creates a bar which renders itself by provided filler. |