diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-06-16 05:57:09 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-06-17 14:59:42 -0400 |
commit | b6662eed3f27ac5466501b046db4f1608845af61 (patch) | |
tree | 7a4f80a77f812505a6261bc11ed8151235f903f1 /vendor/github.com/vbauerster/mpb/v7/bar_filler.go | |
parent | 725b5001a17f703d95a3c88e4f58225c5290576b (diff) | |
download | podman-b6662eed3f27ac5466501b046db4f1608845af61.tar.gz podman-b6662eed3f27ac5466501b046db4f1608845af61.tar.bz2 podman-b6662eed3f27ac5466501b046db4f1608845af61.zip |
Vendor in containers/common v0.40.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/v7/bar_filler.go')
-rw-r--r-- | vendor/github.com/vbauerster/mpb/v7/bar_filler.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v7/bar_filler.go b/vendor/github.com/vbauerster/mpb/v7/bar_filler.go new file mode 100644 index 000000000..a69087c47 --- /dev/null +++ b/vendor/github.com/vbauerster/mpb/v7/bar_filler.go @@ -0,0 +1,39 @@ +package mpb + +import ( + "io" + + "github.com/vbauerster/mpb/v7/decor" +) + +// BarFiller interface. +// Bar (without decorators) renders itself by calling BarFiller's Fill method. +// +// reqWidth is requested width, set by `func WithWidth(int) ContainerOption`. +// If not set, it defaults to terminal width. +// +// Default implementations can be obtained via: +// +// 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. +type BarFillerFunc func(w io.Writer, reqWidth int, stat decor.Statistics) + +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() +} |