Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress bars rendering is disturbed when terminal screen size is small #171

Open
ghost opened this issue Nov 7, 2020 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Nov 7, 2020

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants