diff --git a/bar.go b/bar.go index 00127ba..856a3c5 100644 --- a/bar.go +++ b/bar.go @@ -34,9 +34,9 @@ } // Filler interface. -// Bar renders by calling Filler's Fill method. You can literally -// have any bar kind, by implementing this interface and passing it -// to the Add method. +// Bar renders by calling Filler's Fill method. You can literally have +// any bar kind, by implementing this interface and passing it to the +// Add method. type Filler interface { Fill(w io.Writer, width int, s *decor.Statistics) } @@ -218,8 +218,8 @@ } // IncrBy increments progress bar by amount of n. -// wdd is optional work duration i.e. time.Since(start), -// which expected to be provided, if any ewma based decorator is used. +// wdd is optional work duration i.e. time.Since(start), which expected +// to be provided, if any ewma based decorator is used. func (b *Bar) IncrBy(n int, wdd ...time.Duration) { select { case b.operateState <- func(s *bState) { @@ -239,9 +239,9 @@ // Completed reports whether the bar is in completed state. func (b *Bar) Completed() bool { // omit select here, because primary usage of the method is for loop - // condition, like for !bar.Completed() {...} - // so when toComplete=true it is called once (at which time, the bar is still alive), - // then quits the loop and never suppose to be called afterwards. + // condition, like for !bar.Completed() {...} so when toComplete=true + // it is called once (at which time, the bar is still alive), then + // quits the loop and never suppose to be called afterwards. return <-b.boolCh } diff --git a/decor/moving-average.go b/decor/moving-average.go index bce7755..fcd2689 100644 --- a/decor/moving-average.go +++ b/decor/moving-average.go @@ -7,7 +7,7 @@ ) // MovingAverage is the interface that computes a moving average over -// a time- series stream of numbers. The average may be over a window +// a time-series stream of numbers. The average may be over a window // or exponentially decaying. type MovingAverage interface { Add(float64) diff --git a/options.go b/options.go index 0d7cb78..44a6ee3 100644 --- a/options.go +++ b/options.go @@ -13,9 +13,9 @@ // behavior of progress pool, if passed to mpb.New(...ProgressOption). type ProgressOption func(*pState) -// WithWaitGroup provides means to have a single joint point. If +// WithWaitGroup provides means to have a single joint point. If // *sync.WaitGroup is provided, you can safely call just p.Wait() -// without calling Wait() on provided *sync.WaitGroup. Makes sense +// without calling Wait() on provided *sync.WaitGroup. Makes sense // when there are more than one bar to render. func WithWaitGroup(wg *sync.WaitGroup) ProgressOption { return func(s *pState) { @@ -23,7 +23,8 @@ } } -// WithWidth overrides default width 80. +// WithWidth sets container width. Default is 80. Bars inherit this +// width, as long as no BarWidth is applied. func WithWidth(w int) ProgressOption { return func(s *pState) { if w >= 0 { diff --git a/progress.go b/progress.go index 8b30185..6bae4c2 100644 --- a/progress.go +++ b/progress.go @@ -50,8 +50,8 @@ debugOut io.Writer } -// New creates new Progress instance, which orchestrates bars rendering process. -// Accepts mpb.ProgressOption funcs for customization. +// New creates new Progress instance, which orchestrates bars rendering +// process. Accepts mpb.ProgressOption funcs for customization. func New(options ...ProgressOption) *Progress { pq := make(priorityQueue, 0) heap.Init(&pq) @@ -120,10 +120,10 @@ } } -// Abort is only effective while bar progress is running, -// it means remove bar now without waiting for its completion. -// If bar is already completed, there is nothing to abort. -// If you need to remove bar after completion, use BarRemoveOnComplete BarOption. +// Abort is only effective while bar progress is running, it means +// remove bar now without waiting for its completion. If bar is already +// completed, there is nothing to abort. If you need to remove bar +// after completion, use BarRemoveOnComplete BarOption. func (p *Progress) Abort(b *Bar, remove bool) { select { case p.operateState <- func(s *pState) { @@ -159,9 +159,10 @@ } } -// Wait first waits for user provided *sync.WaitGroup, if any, -// then waits far all bars to complete and finally shutdowns master goroutine. -// After this method has been called, there is no way to reuse *Progress instance. +// Wait first waits for user provided *sync.WaitGroup, if any, then +// waits far all bars to complete and finally shutdowns master goroutine. +// After this method has been called, there is no way to reuse *Progress +// instance. func (p *Progress) Wait() { if p.uwg != nil { p.uwg.Wait() @@ -219,8 +220,8 @@ defer func() { if frameReader.toShutdown { // shutdown at next flush, in other words decrement underlying WaitGroup - // only after the bar with completed state has been flushed. - // this ensures no bar ends up with less than 100% rendered. + // only after the bar with completed state has been flushed. this + // ensures no bar ends up with less than 100% rendered. s.shutdownPending = append(s.shutdownPending, bar) if replacementBar, ok := s.waitBars[bar]; ok { heap.Push(s.bHeap, replacementBar) diff --git a/spinner_filler.go b/spinner_filler.go index c44e3eb..818062d 100644 --- a/spinner_filler.go +++ b/spinner_filler.go @@ -8,8 +8,10 @@ "github.com/vbauerster/mpb/decor" ) +// SpinnerAlignment erum. type SpinnerAlignment int +// SpinnerAlignment kinds. const ( SpinnerOnLeft SpinnerAlignment = iota SpinnerOnMiddle