summaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/v5/decor/any.go
blob: bf9cf51a55a6338c2780710f091dd8af72b1d05f (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 func call back.
//
//	`f` call back which provides string to display
//
//	`wcc` optional WC config
//
func Any(f func(*Statistics) string, wcc ...WC) Decorator {
	return &any{initWC(wcc...), f}
}

type any struct {
	WC
	f func(*Statistics) string
}

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