mirror of
https://github.com/go-task/task.git
synced 2025-06-17 00:17:51 +02:00
fix Taskvars.yml vars not available while interpolating vars
prop
closes #40
This commit is contained in:
2
task.go
2
task.go
@ -98,7 +98,7 @@ func (e *Executor) Run(args ...string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
if err := e.RunTask(context.Background(), Call{Task: a}); err != nil {
|
if err := e.RunTask(context.Background(), Call{Task: a, Vars: e.taskvars}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,7 @@ func TestParams(t *testing.T) {
|
|||||||
{"dep2.txt", "Dependence2\n"},
|
{"dep2.txt", "Dependence2\n"},
|
||||||
{"spanish.txt", "¡Holla mundo!\n"},
|
{"spanish.txt", "¡Holla mundo!\n"},
|
||||||
{"spanish-dep.txt", "¡Holla dependencia!\n"},
|
{"spanish-dep.txt", "¡Holla dependencia!\n"},
|
||||||
|
{"portuguese.txt", "Olá, mundo!\n"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
|
3
testdata/params/Taskfile.yml
vendored
3
testdata/params/Taskfile.yml
vendored
@ -1,6 +1,7 @@
|
|||||||
default:
|
default:
|
||||||
vars:
|
vars:
|
||||||
SPANISH: ¡Holla mundo!
|
SPANISH: ¡Holla mundo!
|
||||||
|
PORTUGUESE: "{{.PORTUGUESE}}"
|
||||||
deps:
|
deps:
|
||||||
- task: write-file
|
- task: write-file
|
||||||
vars: {CONTENT: Dependence1, FILE: dep1.txt}
|
vars: {CONTENT: Dependence1, FILE: dep1.txt}
|
||||||
@ -17,6 +18,8 @@ default:
|
|||||||
vars: {CONTENT: "!", FILE: exclamation.txt}
|
vars: {CONTENT: "!", FILE: exclamation.txt}
|
||||||
- task: write-file
|
- task: write-file
|
||||||
vars: {CONTENT: "{{.SPANISH}}", FILE: spanish.txt}
|
vars: {CONTENT: "{{.SPANISH}}", FILE: spanish.txt}
|
||||||
|
- task: write-file
|
||||||
|
vars: {CONTENT: "{{.PORTUGUESE}}", FILE: portuguese.txt}
|
||||||
|
|
||||||
write-file:
|
write-file:
|
||||||
cmds:
|
cmds:
|
||||||
|
1
testdata/params/Taskvars.yml
vendored
Normal file
1
testdata/params/Taskvars.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
PORTUGUESE: Olá, mundo!
|
Reference in New Issue
Block a user