From 6c215684478288ba893641a51b2158d28febe1f5 Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Wed, 28 Feb 2024 16:44:34 -0600 Subject: [PATCH] fix: list tasks (#1520) --- cmd/task/task.go | 8 ++++---- help.go | 10 ---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cmd/task/task.go b/cmd/task/task.go index 7f9910e0..e9447dee 100644 --- a/cmd/task/task.go +++ b/cmd/task/task.go @@ -264,10 +264,6 @@ func run() error { return err } - if (listOptions.ShouldListTasks()) && flags.silent { - return e.ListTaskNames(flags.listAll) - } - if err := e.Setup(); err != nil { return err } @@ -278,6 +274,10 @@ func run() error { return nil } + if (listOptions.ShouldListTasks()) && flags.silent { + return e.ListTaskNames(flags.listAll) + } + if listOptions.ShouldListTasks() { foundTasks, err := e.ListTasks(listOptions) if err != nil { diff --git a/help.go b/help.go index afb16e53..ca187cc4 100644 --- a/help.go +++ b/help.go @@ -121,16 +121,6 @@ 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) error { - // 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 { - return err - } - } // use stdout if no output defined var w io.Writer = os.Stdout if e.Stdout != nil {