1
0
mirror of https://github.com/go-task/task.git synced 2025-06-16 04:20:56 +03:00

Allow template evaluation in parameters

When passing variables to a sub-task, allow template evaluation
within the passed-on variables.
This commit is contained in:
Sindre Røkenes Myren
2017-07-06 18:40:21 +02:00
committed by Sindre Myren
parent 774ef61c2f
commit 2f9381065d
3 changed files with 14 additions and 1 deletions

10
task.go
View File

@ -237,7 +237,15 @@ func (e *Executor) runCommand(ctx context.Context, task string, i int, vars Vars
cmd := t.Cmds[i]
if cmd.Cmd == "" {
return e.RunTask(ctx, cmd.Task, cmd.Vars)
cmdVars := make(Vars, len(cmd.Vars))
for k, v := range cmd.Vars {
v, err := e.ReplaceVariables(v, task, vars)
if err != nil {
return err
}
cmdVars[k] = v
}
return e.RunTask(ctx, cmd.Task, cmdVars)
}
c, err := e.ReplaceVariables(cmd.Cmd, task, vars)