fix(compiler): add call.Vars support in scoped mode

When calling a task with vars (e.g., `task: name` with `vars:`),
those vars were not being applied in scoped mode. This fix adds
call.Vars to the variable resolution chain.

Variable priority (lowest to highest):
1. Root Taskfile vars
2. Include Taskfile vars
3. Include passthrough vars
4. Task vars
5. Call vars (NEW)
6. CLI vars
This commit is contained in:
Valentin Maerten
2025-12-29 17:07:48 +01:00
parent 5ef7313e95
commit a57a16efca
5 changed files with 67 additions and 12 deletions

View File

@@ -218,6 +218,12 @@ func (c *Compiler) getVariables(t *ast.Task, call *Call, evaluateShVars bool) (*
return nil, err
}
}
// Apply call vars (vars passed when calling a task)
for k, v := range call.Vars.All() {
if err := taskRangeFunc(k, v); err != nil {
return nil, err
}
}
}
// CLI vars have highest priority - applied last to override everything