2021-09-14 20:59:51 +00:00
|
|
|
package progress
|
2021-01-11 23:59:17 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/k0kubun/go-ansi"
|
|
|
|
"github.com/schollz/progressbar/v3"
|
|
|
|
)
|
|
|
|
|
|
|
|
// InitializeProgressBar standard for use in Prysm.
|
|
|
|
func InitializeProgressBar(numItems int, msg string) *progressbar.ProgressBar {
|
|
|
|
return progressbar.NewOptions(
|
|
|
|
numItems,
|
|
|
|
progressbar.OptionFullWidth(),
|
|
|
|
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
|
|
|
|
progressbar.OptionEnableColorCodes(true),
|
|
|
|
progressbar.OptionSetTheme(progressbar.Theme{
|
|
|
|
Saucer: "[green]=[reset]",
|
|
|
|
SaucerHead: "[green]>[reset]",
|
|
|
|
SaucerPadding: " ",
|
|
|
|
BarStart: "[",
|
|
|
|
BarEnd: "]",
|
|
|
|
}),
|
|
|
|
progressbar.OptionOnCompletion(func() { fmt.Println() }),
|
|
|
|
progressbar.OptionSetDescription(msg),
|
|
|
|
)
|
|
|
|
}
|