diff --git a/bar_test.go b/bar_test.go index 5431ea9..ca71513 100644 --- a/bar_test.go +++ b/bar_test.go @@ -121,7 +121,7 @@ p := mpb.New( mpb.WithWidth(100), mpb.WithOutput(&buf), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) total := 100 @@ -153,7 +153,7 @@ p := mpb.New( mpb.WithWidth(80), mpb.WithOutput(&buf), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) total := 50 @@ -181,7 +181,7 @@ p := mpb.New( mpb.WithWidth(80), mpb.WithOutput(&buf), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) bs := mpb.BarStyle() bs.Lbound(string(runes[0])) @@ -257,7 +257,7 @@ ctx, cancel := context.WithCancel(context.Background()) p := mpb.NewWithContext(ctx, mpb.WithOutput(io.Discard), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), mpb.WithShutdownNotifier(shutdown), ) a := p.AddBar(100) diff --git a/container_option.go b/container_option.go index 3a06a19..6664e53 100644 --- a/container_option.go +++ b/container_option.go @@ -78,8 +78,8 @@ } // WithOutput overrides default os.Stdout output. If underlying io.Writer -// is not a terminal then auto refresh is disabled unless ForceAutoRefresh -// option is provided. +// is not a terminal then auto refresh is disabled unless WithAutoRefresh +// option is set. func WithOutput(w io.Writer) ContainerOption { if w == nil { w = io.Discard @@ -99,10 +99,9 @@ } } -// ForceAutoRefresh force auto refresh even if output is not terminal. +// WithAutoRefresh force auto refresh regardless of what output is set to. // Applicable only if not WithManualRefresh set. -// Useful for testing purposes. -func ForceAutoRefresh() ContainerOption { +func WithAutoRefresh() ContainerOption { return func(s *pState) { s.autoRefresh = true } diff --git a/progress_test.go b/progress_test.go index d2bfa55..57bdb7a 100644 --- a/progress_test.go +++ b/progress_test.go @@ -51,7 +51,7 @@ mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard), mpb.WithDebugOutput(&debug), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) var errReturnCount int @@ -99,7 +99,7 @@ p := mpb.New( mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) b := p.AddBar(100) @@ -135,7 +135,7 @@ p := mpb.New( mpb.WithShutdownNotifier(shutdown), mpb.WithOutput(io.Discard), - mpb.ForceAutoRefresh(), + mpb.WithAutoRefresh(), ) b := p.AddBar(100)