From c73ddc35525832e1ec5cfc01d913f85ca4308ccd Mon Sep 17 00:00:00 2001 From: jaedle Date: Sun, 24 Feb 2019 09:27:26 +0100 Subject: [PATCH] refactoring --- task.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/task.go b/task.go index 9c90cebc..e0406c5a 100644 --- a/task.go +++ b/task.go @@ -64,13 +64,7 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error { } if e.Details { - task := calls[0].Task - - if e.Taskfile.Tasks[task].Details == "" { - e.Logger.Errf("task: There is no detailed description for task: %s", task) - } else { - e.Logger.Outf(e.Taskfile.Tasks[task].Details) - } + displayTaskDetails(e, calls[0].Task) return nil } @@ -86,6 +80,14 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error { return nil } +func displayTaskDetails(e *Executor, task string) { + if e.Taskfile.Tasks[task].Details == "" { + e.Logger.Errf("task: There is no detailed description for task: %s", task) + } else { + e.Logger.Outf(e.Taskfile.Tasks[task].Details) + } +} + // Setup setups Executor's internal state func (e *Executor) Setup() error { var err error