Codebase list golang-github-vbauerster-mpb / 82e7b40
drop internal predicate Vladimir Bauer 4 years ago
3 changed file(s) with 8 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
44 "io"
55
66 "github.com/vbauerster/mpb/v7/decor"
7 "github.com/vbauerster/mpb/v7/internal"
87 )
98
109 // BarOption is a func option to alter default behavior of a bar.
148147
149148 // BarOptional will invoke provided option only when pick is true.
150149 func BarOptional(option BarOption, pick bool) BarOption {
151 return BarOptOn(option, internal.Predicate(pick))
150 if pick {
151 return option
152 }
153 return nil
152154 }
153155
154156 // BarOptOn will invoke provided option only when higher order predicate
44 "io/ioutil"
55 "sync"
66 "time"
7
8 "github.com/vbauerster/mpb/v7/internal"
97 )
108
119 // ContainerOption is a func option to alter default behavior of a bar
102100
103101 // ContainerOptional will invoke provided option only when pick is true.
104102 func ContainerOptional(option ContainerOption, pick bool) ContainerOption {
105 return ContainerOptOn(option, internal.Predicate(pick))
103 if pick {
104 return option
105 }
106 return nil
106107 }
107108
108109 // ContainerOptOn will invoke provided option only when higher order
+0
-6
internal/predicate.go less more
0 package internal
1
2 // Predicate helper for internal use.
3 func Predicate(pick bool) func() bool {
4 return func() bool { return pick }
5 }