Skip to content

Commit

Permalink
Trims whitespace on monochrome output; fixes #43
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnomnom committed Jul 5, 2018
1 parent 9a86739 commit dc95f64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ func ungron(r io.Reader, w io.Writer, opts int) (int, error) {
}
}

// For whatever reason, the monochrome version of the JSON
// has a trailing newline character, but the colorized version
// does not. Strip the whitespace so that neither has the newline
// character on the end, and then we'll add a newline in the
// Fprintf below
j = bytes.TrimSpace(j)

fmt.Fprintf(w, "%s\n", j)

return exitOK, nil
Expand Down

0 comments on commit dc95f64

Please sign in to comment.