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:
committed by
Sindre Myren
parent
774ef61c2f
commit
2f9381065d
10
task.go
10
task.go
@ -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)
|
||||
|
Reference in New Issue
Block a user