From 0051217bb5db4e534e2c3597650a32955354a269 Mon Sep 17 00:00:00 2001 From: maride Date: Wed, 8 Jan 2020 08:55:31 +0100 Subject: [PATCH] Add trailing newline to output if it's not present yet --- output/printer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/output/printer.go b/output/printer.go index 8fa4d28..46f87eb 100644 --- a/output/printer.go +++ b/output/printer.go @@ -3,6 +3,7 @@ package output import ( "fmt" "github.com/fatih/color" + "strings" ) const ( @@ -42,8 +43,13 @@ func PrintBlock(headline string, content string) { content = cutContent(content) } - // And print our content. + // Print our content. fmt.Print(content) + + // Check if we need to add a newline character at the end + if !strings.HasSuffix(content, "\n") { + fmt.Print("\n") + } } // Cut content after MaxContentLines lines