Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support multiprogressbars at a time#263

Closed
floaust wants to merge 1 commit intomasterfrom
feat-print-multiple-progressbars
Closed

Support multiprogressbars at a time#263
floaust wants to merge 1 commit intomasterfrom
feat-print-multiple-progressbars

Conversation

@floaust
Copy link
Member

@floaust floaust commented Oct 2, 2021

Description

Added support to run multiple progressbars at a time.

Scope

What is affected by this pull request?

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Related Issue

partly related to #215

To-Do Checklist

  • I tested my changes
  • I have commented every method that I created/changed
  • I updated the examples to fit with my changes
  • I have added tests for my newly created methods

@floaust
Copy link
Member Author

floaust commented Oct 2, 2021

Code to test changes

package main

import (
	`time`

	`github.com/pterm/pterm`
)

func main() {
	area, _ := pterm.DefaultArea.Start()
	p, _ := pterm.DefaultProgressbar.WithPrintTogether(area).WithTotal(2).WithTitle("afgdfgdfgdfgdfg").Start()
	p2, _ := pterm.DefaultProgressbar.WithPrintTogether(area).WithTotal(2).WithTitle("b").Start()
	for i := 0; i < 2; i++ {
		time.Sleep(time.Second)
		p.Increment()
		p2.Increment()
	}
	time.Sleep(time.Second)

	p3, _ := pterm.DefaultProgressbar.WithPrintTogether(area).WithTotal(2).WithTitle("c").Start()
	p4, _ := pterm.DefaultProgressbar.WithPrintTogether(area).WithTotal(2).WithTitle("d").Start()
	for i := 0; i < 2; i++ {
		time.Sleep(time.Second)
		p3.Increment()
		p4.Increment()
	}
	area.Stop()
}

@codecov
Copy link

codecov bot commented Oct 2, 2021

Codecov Report

Merging #263 (ada9ef6) into master (8c14cc1) will decrease coverage by 1.03%.
The diff coverage is 72.34%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master     #263      +/-   ##
===========================================
- Coverage   100.00%   98.96%   -1.04%     
===========================================
  Files           23       23              
  Lines         1239     1259      +20     
===========================================
+ Hits          1239     1246       +7     
- Misses           0       10      +10     
- Partials         0        3       +3     
Impacted Files Coverage Δ
print.go 100.00% <ø> (ø)
progressbar_printer.go 87.73% <72.34%> (-12.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c14cc1...ada9ef6. Read the comment docs.

@floaust floaust linked an issue Oct 2, 2021 that may be closed by this pull request
@floaust floaust added the help wanted Extra attention is needed label Oct 2, 2021
@floaust floaust self-assigned this Oct 2, 2021
@floaust floaust closed this Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can run multi Spinner in at the same time

1 participant