summaryrefslogtreecommitdiffstats
path: root/dependencies/pkg/mod/github.com/vbauerster/mpb/v6@v6.0.4/decor/any.go
blob: 39518f5945716fdd1237513bcea4ea97619d7704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package decor

// Any decorator displays text, that can be changed during decorator's
// lifetime via provided DecorFunc.
//
//	`fn` DecorFunc callback
//
//	`wcc` optional WC config
//
func Any(fn DecorFunc, wcc ...WC) Decorator {
	return &any{initWC(wcc...), fn}
}

type any struct {
	WC
	fn DecorFunc
}

func (d *any) Decor(s Statistics) string {
	return d.FormatMsg(d.fn(s))
}