8000 Progress bars rendering is disturbed when terminal screen size is small · Issue #171 · cheggaaa/pb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Progress bars rendering is disturbed when terminal screen size is small #171
Open
@ghost

Description

@cheggaaa

When the terminal screensize is small and the number of progress bars are more the progress bars rendering fails

func Example_multiple() {
	// create bars
	//first := pb.New(200).Prefix("App1 Deployment Status := Pending")
	//second := pb.New(200).Prefix("App1 Deployment Status := Pending ")
	//third := pb.New(200).Prefix("App1 Deployment Status := Pending ")
	numberOfBars := 100
	var pbs []*pb.ProgressBar
	for i:=1 ;i<=numberOfBars ; i++ {
		bar := pb.New(100).Prefix(fmt.Sprintf("App%d Deployment Status := Pending",i))
		pbs = append(pbs,bar)
	}

	// start pool
	//pool, err := pb.StartPool(first, second, third)
	pool, err := pb.StartPool(pbs...)
	if err != nil {
		panic(err)
	}
	// update bars
	wg := new(sync.WaitGroup)
	for i:=0 ;i<numberOfBars ; i++ {
		wg.Add(1)
		go func(cb *pb.ProgressBar,appName string) {
			for n := 0; n < int(cb.Total); n++ {
				cb.Increment()
				time.Sleep(time.Millisecond * time.Duration(rand.Intn(100)))
				cb.Prefix(fmt.Sprintf("%s Deployment Status := Inprogress",appName))
			}
			cb.Finish()
			wg.Done()
		}(pbs[i],fmt.Sprintf("App%d",i+1))
	}
	wg.Wait()
	// close pool
	pool.Stop()
}

Screenshot 2020-11-07 at 22 23 42

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0