Skip to content

Commit

Permalink
Trim trailing spaces in logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Dec 3, 2024
1 parent 95be352 commit d75aa5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"slices"
"strings"

"github.com/dogmatiq/aureus/internal/diff"
Expand Down Expand Up @@ -185,6 +186,12 @@ func logSection(

w.WriteString("\x1b[1m│\x1b[0m\n")

body = slices.Clone(body)
body, ok := bytes.CutSuffix(body, newLine)
if !ok {
body = append(body, []byte("\n(no newline)")...)
}

for _, line := range bytes.Split(body, newLine) {
w.WriteString("\x1b[1m│\x1b[0m ")
w.WriteString(bodyANSI)
Expand Down

0 comments on commit d75aa5f

Please sign in to comment.