github.com/prysmaticlabs/prysm@v1.4.4/shared/progressutil/progress.go (about)

     1  package progressutil
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/k0kubun/go-ansi"
     7  	"github.com/schollz/progressbar/v3"
     8  )
     9  
    10  // InitializeProgressBar standard for use in Prysm.
    11  func InitializeProgressBar(numItems int, msg string) *progressbar.ProgressBar {
    12  	return progressbar.NewOptions(
    13  		numItems,
    14  		progressbar.OptionFullWidth(),
    15  		progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
    16  		progressbar.OptionEnableColorCodes(true),
    17  		progressbar.OptionSetTheme(progressbar.Theme{
    18  			Saucer:        "[green]=[reset]",
    19  			SaucerHead:    "[green]>[reset]",
    20  			SaucerPadding: " ",
    21  			BarStart:      "[",
    22  			BarEnd:        "]",
    23  		}),
    24  		progressbar.OptionOnCompletion(func() { fmt.Println() }),
    25  		progressbar.OptionSetDescription(msg),
    26  	)
    27  }