Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow template evaluation when calling a task with vars #39

Merged
merged 2 commits into from
Jul 7, 2017

Conversation

smyrman
Copy link
Contributor

@smyrman smyrman commented Jul 6, 2017

Fixes issue #38 by allowing for template evaluation when calling a task with override variables:

echo:
  cmds:
    - "echo {{.MYVAR}}"
default:
  vars:
    PLEASE: "awesome"
  cmds:
    - task: echo
      vars: {MYVAR: "{{.PLEASE}}"}

@smyrman smyrman changed the title Issue 38 Allow template evaluation when calling a task with vars Jul 6, 2017
task.go Outdated
@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmdVars := make(Vars, len(cmd.Vars))

task.go Outdated
return e.RunTask(ctx, cmd.Task, cmd.Vars)
cmdVars := make(Vars)
for k := range cmd.Vars {
v, err := e.ReplaceVariables(cmd.Vars[k], task, vars)
Copy link
Member

@andreynering andreynering Jul 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for k, v := range cmd.Vars {
	v, err := e.RaplaceVariables(v, task, vars)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@andreynering andreynering added the type: enhancement A change to an existing feature or functionality. label Jul 6, 2017
When passing variables to a sub-task, allow template evaluation
within the passed-on variables.
@andreynering
Copy link
Member

Thanks

@andreynering andreynering merged commit 645f77b into go-task:master Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A change to an existing feature or functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants