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
|
package parse
import (
"io"
)
type options struct {
w io.Writer
follow bool
followVerbose bool
debug bool
progress bool
progressOutput io.Writer
}
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 io.Writer) OptionsFunc {
return func(o *options) { o.progressOutput = w }
}
|