godoc upd
Vladimir Bauer
5 years ago
| 8 | 8 |
// BarFiller interface.
|
| 9 | 9 |
// Bar (without decorators) renders itself by calling BarFiller's Fill method.
|
| 10 | 10 |
//
|
| 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.
|
| 14 | 13 |
//
|
| 15 | 14 |
// Default implementations can be obtained via:
|
| 16 | 15 |
//
|
| 17 | 16 |
// func NewBarFiller(style string) BarFiller
|
|
17 |
// func NewBarFillerRev(style string) BarFiller
|
|
18 |
// func NewBarFillerPick(style string, rev bool) BarFiller
|
| 18 | 19 |
// func NewSpinnerFiller(style []string, alignment SpinnerAlignment) BarFiller
|
| 19 | 20 |
//
|
| 20 | 21 |
type BarFiller interface {
|
| 7 | 7 |
"github.com/vbauerster/mpb/v6/internal"
|
| 8 | 8 |
)
|
| 9 | 9 |
|
| 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.
|
| 11 | 11 |
type BarOption func(*bState)
|
| 12 | 12 |
|
| 13 | 13 |
func (s *bState) addDecorators(dest *[]decor.Decorator, decorators ...decor.Decorator) {
|
| 8 | 8 |
"github.com/vbauerster/mpb/v6/internal"
|
| 9 | 9 |
)
|
| 10 | 10 |
|
| 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.
|
| 13 | 14 |
type ContainerOption func(*pState)
|
| 14 | 15 |
|
| 15 | 16 |
// WithWaitGroup provides means to have a single joint point. If
|
|
| 22 | 23 |
}
|
| 23 | 24 |
}
|
| 24 | 25 |
|
| 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`.
|
| 27 | 29 |
func WithWidth(width int) ContainerOption {
|
| 28 | 30 |
return func(s *pState) {
|
| 29 | 31 |
s.reqWidth = width
|