1
0
mirror of https://github.com/go-task/task.git synced 2025-04-11 11:41:56 +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.
// 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 {