From b97221cdb223f980549725e76bb703b9753f244e Mon Sep 17 00:00:00 2001
From: jaedle <dennis.jekubczyk@gmail.com>
Date: Sun, 24 Feb 2019 11:31:25 +0100
Subject: [PATCH] ignore empty lines on description

---
 task.go      | 14 ++++++++++----
 task_test.go |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/task.go b/task.go
index 49fa1049..9e4123b4 100644
--- a/task.go
+++ b/task.go
@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"io"
 	"os"
+	"strings"
 	"sync/atomic"
 
 	"github.com/go-task/task/v2/internal/compiler"
@@ -81,11 +82,16 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error {
 }
 
 func (e *Executor) displayTaskDetails(task string) {
-	if e.Taskfile.Tasks[task].Details == "" {
+	s := e.Taskfile.Tasks[task].Details
+	if s == "" {
 		e.Logger.Errf("task: There is no detailed description for task: %s", task)
-	} else {
-
-		e.Logger.Outf(e.Taskfile.Tasks[task].Details)
+		return
+	}
+	lines := strings.Split(s, "\n")
+	for _, line := range lines {
+		if line != "" {
+			e.Logger.Outf(line)
+		}
 	}
 }
 
diff --git a/task_test.go b/task_test.go
index 6c7c18f0..aedece21 100644
--- a/task_test.go
+++ b/task_test.go
@@ -582,7 +582,7 @@ func TestDetails(t *testing.T) {
 
 	buff.Reset()
 	assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-details"}))
-	assert.Equal(t, buff.String(), "details of task-with-details - line 1\n"+"line 2\n"+"line 3\n\n")
+	assert.Equal(t, buff.String(), "details of task-with-details - line 1\n"+"line 2\n"+"line 3\n")
 
 	assert.NotContains(t, buff.String(), "task-with-details was executed")
 	assert.NotContains(t, buff.String(), "dependend-task was executed")