github.com/polym/upx@v0.2.6/progress.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/gosuri/uiprogress"
     5  	"time"
     6  )
     7  
     8  var progress *uiprogress.Progress
     9  
    10  func AddBar(id, total int) (*uiprogress.Bar, int) {
    11  	if id >= len(progress.Bars) || id < 0 {
    12  		return progress.AddBar(total), len(progress.Bars) - 1
    13  	} else {
    14  		progress.Bars[id] = uiprogress.NewBar(total)
    15  		return progress.Bars[id], id
    16  	}
    17  }
    18  
    19  func initProgress() {
    20  	progress = uiprogress.New()
    21  	progress.RefreshInterval = time.Millisecond * 100
    22  }