diff --git a/bar_filler.go b/bar_filler.go index c8cedaa..3d582a4 100644 --- a/bar_filler.go +++ b/bar_filler.go @@ -14,13 +14,16 @@ // // Default implementations can be obtained via: // -// func NewBarFiller(style string) BarFiller -// func NewBarFillerRev(style string) BarFiller -// func NewBarFillerPick(style string, rev bool) BarFiller -// func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller +// func NewBarFiller(BarStyle()) BarFiller +// func NewBarFiller(SpinnerStyle()) BarFiller // type BarFiller interface { Fill(w io.Writer, reqWidth int, stat decor.Statistics) +} + +// BarFillerBuilder interface. +type BarFillerBuilder interface { + Build() BarFiller } // BarFillerFunc is function type adapter to convert function into BarFiller. @@ -29,3 +32,8 @@ func (f BarFillerFunc) Fill(w io.Writer, reqWidth int, stat decor.Statistics) { f(w, reqWidth, stat) } + +// NewBarFiller constructs a BarFiller from provided BarFillerBuilder. +func NewBarFiller(b BarFillerBuilder) BarFiller { + return b.Build() +}