refactor: prependElapsed example
Vladimir Bauer
9 years ago
| 18 | 18 | p := mpb.New(nil).SetWidth(64) |
| 19 | 19 | // p := mpb.New(nil).RefreshRate(80 * time.Millisecond).SetWidth(64) |
| 20 | 20 | |
| 21 | name1 := "Bar#1: " | |
| 21 | name1 := "Bar#1:" | |
| 22 | 22 | bar1 := p.AddBar(50). |
| 23 | PrependName(name1, len(name1)).PrependElapsed(3). | |
| 24 | AppendPercentage().TrimRightSpace() | |
| 23 | PrependName(name1, 0, mpb.DwidthSync|mpb.DidentRight). | |
| 24 | PrependElapsed(3, mpb.DwidthSync|mpb.DextraSpace). | |
| 25 | AppendPercentage(5, 0) | |
| 26 | ||
| 25 | 27 | wg.Add(1) |
| 26 | 28 | go func() { |
| 27 | 29 | defer wg.Done() |
| 34 | 36 | }() |
| 35 | 37 | |
| 36 | 38 | bar2 := p.AddBar(100). |
| 37 | PrependName("", 0-len(name1)).PrependElapsed(3). | |
| 38 | AppendPercentage().TrimRightSpace() | |
| 39 | PrependName("", 0, mpb.DwidthSync). | |
| 40 | PrependElapsed(3, mpb.DwidthSync|mpb.DextraSpace). | |
| 41 | AppendPercentage(5, 0) | |
| 42 | ||
| 39 | 43 | wg.Add(1) |
| 40 | 44 | go func() { |
| 41 | 45 | defer wg.Done() |
| 48 | 52 | }() |
| 49 | 53 | |
| 50 | 54 | bar3 := p.AddBar(80). |
| 51 | PrependName("Bar#3: ", 0).PrependElapsed(3). | |
| 52 | AppendPercentage().TrimRightSpace() | |
| 55 | PrependName("Bar#3:", 0, mpb.DwidthSync|mpb.DidentRight). | |
| 56 | PrependElapsed(3, mpb.DwidthSync|mpb.DextraSpace). | |
| 57 | AppendPercentage(5, 0) | |
| 58 | ||
| 53 | 59 | wg.Add(1) |
| 54 | 60 | go func() { |
| 55 | 61 | defer wg.Done() |