From ba81181eb7f625baea3932e84285aa15a8391d00 Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Mon, 19 Feb 2024 21:01:40 +0000 Subject: [PATCH] fix: setup logger if nil when listing task names --- help.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/help.go b/help.go index b7f0dfc3..baea689e 100644 --- a/help.go +++ b/help.go @@ -122,6 +122,10 @@ func (e *Executor) ListTasks(o ListOptions) (bool, error) { // Only tasks with a non-empty description are printed if allTasks is false. // Otherwise, all task names are printed. func (e *Executor) ListTaskNames(allTasks bool) { + // if called from cmd/task.go, e.Logger has not yet been initialized + if e.Logger == nil { + e.setupLogger() + } // if called from cmd/task.go, e.Taskfile has not yet been parsed if e.Taskfile == nil { if err := e.readTaskfile(); err != nil {