github.com/kcmvp/gob@v1.0.17/cmd/gbc/artifact/progress.go (about)

     1  package artifact
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/samber/lo"
     7  	"github.com/schollz/progressbar/v3"
     8  )
     9  
    10  func NewProgress() *progressbar.ProgressBar {
    11  	spinner := []string{"←", "↑", "→", "↓"}
    12  	return progressbar.NewOptions(-1,
    13  		progressbar.OptionEnableColorCodes(true),
    14  		progressbar.OptionSetWidth(5),
    15  		progressbar.OptionSpinnerCustom(lo.Map(spinner, func(item string, idx int) string {
    16  			return fmt.Sprintf("[yellow]%s", item)
    17  		})),
    18  		progressbar.OptionFullWidth(),
    19  		progressbar.OptionSetRenderBlankState(true),
    20  		progressbar.OptionEnableColorCodes(true),
    21  	)
    22  }