Codebase list golang-github-vbauerster-mpb / b53cde0
minor: WithOutput refactoring Vladimir Bauer 3 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
7171 // will effectively disable auto refresh rate and discard any output,
7272 // useful if you want to disable progress bars with little overhead.
7373 func WithOutput(w io.Writer) ContainerOption {
74 var discarded bool
75 if w == nil {
76 w = io.Discard
77 discarded = true
78 }
7479 return func(s *pState) {
75 if w == nil {
76 s.output = io.Discard
77 s.outputDiscarded = true
78 return
79 }
8080 s.output = w
81 s.outputDiscarded = discarded
8182 }
8283 }
8384