pool_x.go 405 B

12345678910111213141516171819202122
  1. // +build linux darwin freebsd netbsd openbsd solaris dragonfly
  2. package pb
  3. import "fmt"
  4. func (p *Pool) print(first bool) bool {
  5. var out string
  6. if !first {
  7. out = fmt.Sprintf("\033[%dA", len(p.bars))
  8. }
  9. isFinished := true
  10. for _, bar := range p.bars {
  11. if !bar.isFinish {
  12. isFinished = false
  13. }
  14. bar.Update()
  15. out += fmt.Sprintf("\r%s\n", bar.String())
  16. }
  17. fmt.Print(out)
  18. return isFinished
  19. }