1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

fix: setup logger if nil when listing task names

This commit is contained in:
Pete Davison
2024-02-19 21:01:40 +00:00
committed by Andrey Nering
parent e2b0789b0c
commit ba81181eb7

View File

@@ -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. // Only tasks with a non-empty description are printed if allTasks is false.
// Otherwise, all task names are printed. // Otherwise, all task names are printed.
func (e *Executor) ListTaskNames(allTasks bool) { 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 called from cmd/task.go, e.Taskfile has not yet been parsed
if e.Taskfile == nil { if e.Taskfile == nil {
if err := e.readTaskfile(); err != nil { if err := e.readTaskfile(); err != nil {