mirror of
https://github.com/go-task/task.git
synced 2026-06-28 15:14:18 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user