Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #24 from msabramo/GH-23_terminate_all_JSON_output_…
Browse files Browse the repository at this point in the history
…with_newline

Terminate all JSON output with a newline
  • Loading branch information
ChrisAubuchon authored Jun 27, 2016
2 parents aa5616c + ee3b76b commit c3c73c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commands/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ func (c *Cmd) OutputJSON(v interface{}, prettyFlag bool) error {

fmt.Fprintf(c.Out, string(jsonRaw))

jsonStr := string(jsonRaw)
if strings.HasSuffix(jsonStr, "\n") {
fmt.Fprintf(c.Out, jsonStr)
} else {
fmt.Fprintf(c.Out, jsonStr+"\n")
}

return nil
}

Expand Down

0 comments on commit c3c73c0

Please sign in to comment.