(*Progress).AddBarWithID signature change
Vladimir Bauer
9 years ago
| 52 | 52 |
till int64
|
| 53 | 53 |
}
|
| 54 | 54 |
state struct {
|
| 55 | |
id int64
|
|
55 |
id int
|
| 56 | 56 |
format formatRunes
|
| 57 | 57 |
etaAlpha float64
|
| 58 | 58 |
barWidth int
|
|
| 69 | 69 |
}
|
| 70 | 70 |
)
|
| 71 | 71 |
|
| 72 | |
func newBar(ctx context.Context, wg *sync.WaitGroup, id, total int64, width int, format string) *Bar {
|
|
72 |
func newBar(ctx context.Context, wg *sync.WaitGroup, id int, total int64, width int, format string) *Bar {
|
| 73 | 73 |
b := &Bar{
|
| 74 | 74 |
formatElementCh: make(chan runeFormatElement),
|
| 75 | 75 |
etaAlphaCh: make(chan float64),
|
|
| 219 | 219 |
}
|
| 220 | 220 |
|
| 221 | 221 |
// GetID returs id of the bar
|
| 222 | |
func (b *Bar) GetID() int64 {
|
|
222 |
func (b *Bar) GetID() int {
|
| 223 | 223 |
state := b.getState()
|
| 224 | 224 |
return state.id
|
| 225 | 225 |
}
|
|
| 288 | 288 |
return state.draw(termWidth)
|
| 289 | 289 |
}
|
| 290 | 290 |
|
| 291 | |
func (b *Bar) server(ctx context.Context, wg *sync.WaitGroup, id, total int64, width int, format string) {
|
|
291 |
func (b *Bar) server(ctx context.Context, wg *sync.WaitGroup, id int, total int64, width int, format string) {
|
| 292 | 292 |
var completed bool
|
| 293 | 293 |
timeStarted := time.Now()
|
| 294 | 294 |
blockStartTime := timeStarted
|
| 138 | 138 |
|
| 139 | 139 |
// AddBarWithID creates a new progress bar and adds to the container
|
| 140 | 140 |
// pancis, if called on stopped Progress instance, i.e after Stop()
|
| 141 | |
func (p *Progress) AddBarWithID(id, total int64) *Bar {
|
|
141 |
func (p *Progress) AddBarWithID(id int, total int64) *Bar {
|
| 142 | 142 |
if IsClosed(p.done) {
|
| 143 | 143 |
panic(ErrCallAfterStop)
|
| 144 | 144 |
}
|