refactor: cancel example
Vladimir Bauer
9 years ago
| 20 | 20 | defer cancel() |
| 21 | 21 | p := mpb.New(ctx).SetWidth(64) |
| 22 | 22 | |
| 23 | name1 := "Bar#1: " | |
| 23 | name1 := "Bar#1:" | |
| 24 | 24 | bar1 := p.AddBar(50). |
| 25 | PrependName(name1, len(name1)).PrependETA(4). | |
| 26 | AppendPercentage().TrimRightSpace() | |
| 25 | PrependName(name1, 0, mpb.DwidthSync|mpb.DidentRight). | |
| 26 | PrependETA(4, mpb.DwidthSync|mpb.DextraSpace). | |
| 27 | AppendPercentage(5, 0) | |
| 27 | 28 | wg.Add(1) |
| 28 | 29 | go func() { |
| 29 | 30 | defer wg.Done() |
| 41 | 42 | }() |
| 42 | 43 | |
| 43 | 44 | bar2 := p.AddBar(100). |
| 44 | PrependName("", 0-len(name1)).PrependETA(4). | |
| 45 | AppendPercentage().TrimRightSpace() | |
| 45 | PrependName("", 0, mpb.DwidthSync). | |
| 46 | PrependETA(4, mpb.DwidthSync|mpb.DextraSpace). | |
| 47 | AppendPercentage(5, 0) | |
| 46 | 48 | wg.Add(1) |
| 47 | 49 | go func() { |
| 48 | 50 | defer wg.Done() |
| 60 | 62 | }() |
| 61 | 63 | |
| 62 | 64 | bar3 := p.AddBar(80). |
| 63 | PrependName("Bar#3: ", 0).PrependETA(4). | |
| 64 | AppendPercentage().TrimRightSpace() | |
| 65 | PrependName("Bar#3:", 0, mpb.DwidthSync|mpb.DidentRight). | |
| 66 | PrependETA(4, mpb.DwidthSync|mpb.DextraSpace). | |
| 67 | AppendPercentage(5, 0) | |
| 65 | 68 | wg.Add(1) |
| 66 | 69 | go func() { |
| 67 | 70 | defer wg.Done() |