diff --git a/bar.go b/bar.go index ed46f69..be8746e 100644 --- a/bar.go +++ b/bar.go @@ -75,13 +75,13 @@ } ) -func newBar(ID int, total int64, wg *sync.WaitGroup, cancel <-chan struct{}, options ...BarOption) *Bar { +func newBar(id int, total int64, wg *sync.WaitGroup, cancel <-chan struct{}, options ...BarOption) *Bar { if total <= 0 { total = time.Now().Unix() } s := &bState{ - id: ID, + id: id, total: total, etaAlpha: etaAlpha, dropRatio: 10, @@ -179,6 +179,7 @@ } } +// NumOfAppenders returns current number of append decorators func (b *Bar) NumOfAppenders() int { result := make(chan int, 1) select { @@ -189,6 +190,7 @@ } } +// NumOfPrependers returns current number of prepend decorators func (b *Bar) NumOfPrependers() int { result := make(chan int, 1) select { @@ -210,6 +212,7 @@ } } +// Current returns bar's current number, in other words sum of all increments. func (b *Bar) Current() int64 { result := make(chan int64, 1) select { @@ -220,6 +223,7 @@ } } +// Total returns bar's total number. func (b *Bar) Total() int64 { result := make(chan int64, 1) select { diff --git a/bar_option.go b/bar_option.go index d21fc34..5c0a126 100644 --- a/bar_option.go +++ b/bar_option.go @@ -34,7 +34,7 @@ } } -// BarTirm trims both left and right spaces of the bar +// BarTrim trims both left and right spaces of the bar func BarTrim() BarOption { return func(s *bState) { s.trimLeftSpace = true diff --git a/options_go1.7.go b/options_go1.7.go index 5ebf37b..61d94aa 100644 --- a/options_go1.7.go +++ b/options_go1.7.go @@ -4,6 +4,7 @@ import "context" +// WithContext provided context will be used for cancellation purposes func WithContext(ctx context.Context) ProgressOption { return func(s *pState) { if ctx != nil {