Skip to content

Commit

Permalink
progress: fix missing "\n" in plain progress
Browse files Browse the repository at this point in the history
This commit fixes the missing \n when plain progress is used. Without
the output looks rather silly :/
  • Loading branch information
mvo5 authored and ondrejbudai committed Dec 19, 2024
1 parent 8f3ca27 commit 2136cd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions bib/internal/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions bib/internal/progress/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2136cd7

Please sign in to comment.