feat: add task location data to json output (#1056)

* feat: add task location data to json output

* feat: add root taskfile location to --json output
This commit is contained in:
Pete Davison
2023-03-17 12:34:06 +00:00
committed by GitHub
parent 15ef1fa1c2
commit e40d2eec9e
11 changed files with 169 additions and 44 deletions

View File

@@ -176,12 +176,18 @@ func Taskfile(readerNode *ReaderNode) (*taskfile.Taskfile, string, error) {
}
}
for name, task := range t.Tasks {
// Set the location of the Taskfile
t.Location = path
for _, task := range t.Tasks {
// If the task is not defined, create a new one
if task == nil {
task = &taskfile.Task{}
t.Tasks[name] = task
}
task.Task = name
// Set the location of the taskfile for each task
if task.Location.Taskfile == "" {
task.Location.Taskfile = path
}
}
return t, readerNode.Dir, nil