Codebase list golang-github-vbauerster-mpb / 261641e
godoc upd Vladimir Bauer 5 years ago
3 changed file(s) with 11 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
88 // BarFiller interface.
99 // Bar (without decorators) renders itself by calling BarFiller's Fill method.
1010 //
11 // `reqWidth` is requested width, which is set via:
12 // func WithWidth(width int) ContainerOption
13 // func BarWidth(width int) BarOption
11 // reqWidth is requested width, set by `func WithWidth(int) ContainerOption`.
12 // If not set, it defaults to terminal width.
1413 //
1514 // Default implementations can be obtained via:
1615 //
1716 // func NewBarFiller(style string) BarFiller
17 // func NewBarFillerRev(style string) BarFiller
18 // func NewBarFillerPick(style string, rev bool) BarFiller
1819 // func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller
1920 //
2021 type BarFiller interface {
77 "github.com/vbauerster/mpb/v6/internal"
88 )
99
10 // BarOption is a function option which changes the default behavior of a bar.
10 // BarOption is a func option to alter default behavior of a bar.
1111 type BarOption func(*bState)
1212
1313 func (s *bState) addDecorators(dest *[]decor.Decorator, decorators ...decor.Decorator) {
88 "github.com/vbauerster/mpb/v6/internal"
99 )
1010
11 // ContainerOption is a function option which changes the default
12 // behavior of progress container, if passed to mpb.New(...ContainerOption).
11 // ContainerOption is a func option to alter default behavior of a bar
12 // container. Container term refers to a Progress struct which can
13 // hold one or more Bars.
1314 type ContainerOption func(*pState)
1415
1516 // WithWaitGroup provides means to have a single joint point. If
2223 }
2324 }
2425
25 // WithWidth sets container width. If not set underlying bars will
26 // occupy whole term width.
26 // WithWidth sets container width. If not set it defaults to terminal
27 // width. A bar added to the container will inherit its width, unless
28 // overridden by `func BarWidth(int) BarOption`.
2729 func WithWidth(width int) ContainerOption {
2830 return func(s *pState) {
2931 s.reqWidth = width