correct mexicanBar example
Vladimir Bauer
2 years ago
| 15 | 15 | total := 100 |
| 16 | 16 | name := "Complex Filler:" |
| 17 | 17 | bs := mpb.BarStyle() |
| 18 | bs.LboundMeta(func(s string) string { | |
| 18 | bs = bs.LboundMeta(func(s string) string { | |
| 19 | 19 | return fmt.Sprint("\033[34m", s, "\033[0m") // blue |
| 20 | 20 | }) |
| 21 | bs.Filler("_").FillerMeta(func(s string) string { | |
| 21 | bs = bs.Filler("_").FillerMeta(func(s string) string { | |
| 22 | 22 | return fmt.Sprint("\033[36m", s, "\033[0m") // cyan |
| 23 | 23 | }) |
| 24 | bs.Tip("⛵").TipMeta(func(s string) string { | |
| 24 | bs = bs.Tip("⛵").TipMeta(func(s string) string { | |
| 25 | 25 | return fmt.Sprint("\033[31m", s, "\033[0m") // red |
| 26 | 26 | }) |
| 27 | bs.TipOnComplete() // leave tip on complete | |
| 28 | bs.Padding("_").PaddingMeta(func(s string) string { | |
| 27 | bs = bs.TipOnComplete() // leave tip on complete | |
| 28 | bs = bs.Padding("_").PaddingMeta(func(s string) string { | |
| 29 | 29 | return fmt.Sprint("\033[36m", s, "\033[0m") // cyan |
| 30 | 30 | }) |
| 31 | bs.RboundMeta(func(s string) string { | |
| 31 | bs = bs.RboundMeta(func(s string) string { | |
| 32 | 32 | return fmt.Sprint("\033[34m", s, "\033[0m") // blue |
| 33 | 33 | }) |
| 34 | 34 | bar := p.New(int64(total), bs, |