diff --git a/src/internal/packager/images/pull.go b/src/internal/packager/images/pull.go index 11e45d9a2c..fdd81f8194 100644 --- a/src/internal/packager/images/pull.go +++ b/src/internal/packager/images/pull.go @@ -82,7 +82,7 @@ func (i *ImgConfig) PullAll() error { for update := range progress { switch { case update.Error != nil && errors.Is(update.Error, io.EOF): - progressBar.Success("Pulling %d images (%s)", len(imageMap), utils.ByteFormat(float64(update.Total), 2)) + progressBar.Successf("Pulling %d images (%s)", len(imageMap), utils.ByteFormat(float64(update.Total), 2)) return nil case update.Error != nil && strings.HasPrefix(update.Error.Error(), "archive/tar: missed writing "): // Handle potential image cache corruption with a more helpful error. See L#54 in libexec/src/archive/tar/writer.go diff --git a/src/pkg/message/progress.go b/src/pkg/message/progress.go index a808531ea5..8358c7eeab 100644 --- a/src/pkg/message/progress.go +++ b/src/pkg/message/progress.go @@ -5,8 +5,6 @@ package message import ( - "fmt" - "github.com/pterm/pterm" ) @@ -17,9 +15,8 @@ type ProgressBar struct { } // NewProgressBar creates a new ProgressBar instance from a total value and a format. -func NewProgressBar(total int64, format string, a ...any) *ProgressBar { +func NewProgressBar(total int64, text string) *ProgressBar { var progress *pterm.ProgressbarPrinter - text := fmt.Sprintf(" "+format, a...) if NoProgress { Info(text) } else { @@ -57,9 +54,9 @@ func (p *ProgressBar) Write(data []byte) (int, error) { } // Success marks the ProgressBar as successful in the CLI. -func (p *ProgressBar) Success(text string, a ...any) { +func (p *ProgressBar) Successf(format string, a ...any) { p.Stop() - pterm.Success.Printfln(text, a...) + pterm.Success.Printfln(format, a...) } // Stop stops the ProgressBar from continuing. diff --git a/src/pkg/utils/network.go b/src/pkg/utils/network.go index 6424ee6a85..c66f030673 100644 --- a/src/pkg/utils/network.go +++ b/src/pkg/utils/network.go @@ -156,7 +156,7 @@ func httpGetFile(url string, destinationFile *os.File) { progressBar.Fatalf(err, "Unable to save the file %s", destinationFile.Name()) } - progressBar.Success(text) + progressBar.Successf("%s", text) } func sgetFile(url string, destinationFile *os.File, cosignKeyPath string) {