From 99541d25d9833bf44650be268b57ff917f5129a0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 19 Dec 2024 13:06:04 +0100 Subject: [PATCH] progress: fix missing "\n" in plain progress This commit fixes the missing \n when plain progress is used. Without the output looks rather silly :/ --- bib/internal/progress/progress.go | 2 ++ bib/internal/progress/progress_test.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bib/internal/progress/progress.go b/bib/internal/progress/progress.go index 3e7bf4ce..7e6eefa9 100644 --- a/bib/internal/progress/progress.go +++ b/bib/internal/progress/progress.go @@ -246,10 +246,12 @@ func NewPlainProgressBar() (ProgressBar, error) { func (b *plainProgressBar) SetPulseMsgf(msg string, args ...interface{}) { fmt.Fprintf(b.w, msg, args...) + fmt.Fprintf(b.w, "\n") } func (b *plainProgressBar) SetMessagef(msg string, args ...interface{}) { fmt.Fprintf(b.w, msg, args...) + fmt.Fprintf(b.w, "\n") } func (b *plainProgressBar) Start() { diff --git a/bib/internal/progress/progress_test.go b/bib/internal/progress/progress_test.go index 6b11d6f6..211fc221 100644 --- a/bib/internal/progress/progress_test.go +++ b/bib/internal/progress/progress_test.go @@ -47,11 +47,11 @@ func TestPlainProgress(t *testing.T) { // but it shows the messages pbar.SetPulseMsgf("pulse") - assert.Equal(t, "pulse", buf.String()) + assert.Equal(t, "pulse\n", buf.String()) buf.Reset() pbar.SetMessagef("message") - assert.Equal(t, "message", buf.String()) + assert.Equal(t, "message\n", buf.String()) buf.Reset() pbar.Start()