forked from mfridman/tparse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_options.go
More file actions
52 lines (39 loc) · 982 Bytes
/
process_options.go
File metadata and controls
52 lines (39 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package parse
import (
"io"
)
type progressWriter interface {
io.Writer
FormatAction(Action) string
}
type options struct {
w io.Writer
follow bool
followVerbose bool
debug bool
progress bool
progressOutput progressWriter
includeTimestamp bool
}
type OptionsFunc func(o *options)
func WithFollowOutput(b bool) OptionsFunc {
return func(o *options) { o.follow = b }
}
func WithFollowVersboseOutput(b bool) OptionsFunc {
return func(o *options) { o.followVerbose = b }
}
func WithWriter(w io.Writer) OptionsFunc {
return func(o *options) { o.w = w }
}
func WithDebug() OptionsFunc {
return func(o *options) { o.debug = true }
}
func WithProgress(b bool) OptionsFunc {
return func(o *options) { o.progress = b }
}
func WithProgressOutput(w progressWriter) OptionsFunc {
return func(o *options) { o.progressOutput = w }
}
func WithIncludeTimestamp(b bool) OptionsFunc {
return func(o *options) { o.includeTimestamp = b }
}