mirror of
https://github.com/go-task/task.git
synced 2026-06-23 12:45:52 +00:00
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:
13
testdata/scoped_taskfiles/Taskfile.yml
vendored
13
testdata/scoped_taskfiles/Taskfile.yml
vendored
@@ -42,3 +42,16 @@ tasks:
|
||||
LOL: prout_from_root
|
||||
cmds:
|
||||
- echo "{{.LOL}}"
|
||||
|
||||
call-with-vars:
|
||||
desc: Test calling a task with vars override
|
||||
cmds:
|
||||
- task: print-name
|
||||
vars:
|
||||
NAME: from_caller
|
||||
|
||||
print-name:
|
||||
vars:
|
||||
NAME: default_name
|
||||
cmds:
|
||||
- echo "NAME={{.NAME}}"
|
||||
|
||||
1
testdata/scoped_taskfiles/testdata/TestScopedTaskfiles-scoped-call-vars.golden
vendored
Normal file
1
testdata/scoped_taskfiles/testdata/TestScopedTaskfiles-scoped-call-vars.golden
vendored
Normal file
@@ -0,0 +1 @@
|
||||
NAME=from_caller
|
||||
Reference in New Issue
Block a user