From 01b9bf52896d62d99c7e3924150d524fa6dec85a Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Wed, 5 Jul 2017 20:30:58 -0300 Subject: [PATCH] update README documentation about calling another task --- README.md | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fe1841bd..9f18691f 100644 --- a/README.md +++ b/README.md @@ -165,22 +165,53 @@ The above will fail with the message: "cyclic dependency detected". When a task has many dependencies, they are executed concurrently. This will often result in a faster build pipeline. But in some situations you may need -to call other tasks serially. For this just prefix a command with `^`: +to call other tasks serially. In this case, just use the following syntax: + +```yml +main-task: + cmds: + - task: task-to-be-called + - task: another-task + - echo "Both done" + +task-to-be-called: + cmds: + - echo "Task to be called" + +another-task: + cmds: + - echo "Another task" +``` + +Overriding variables in the called task is as simple as informing `vars` +attribute: + +```yml +main-task: + cmds: + - task: write-file + vars: {FILE: "hello.txt", CONTENT: "Hello!"} + - task: write-file + vars: {FILE: "world.txt", CONTENT: "World!"} + +write-file: + cmds: + - echo "{{.CONTENT}}" > {{.FILE}} +``` + +The above syntax is also supported in `deps`. + +> NOTE: It's also possible to call a task without any param prefixing it +with `^`, but this syntax is deprecaded: ```yml a-task: cmds: - ^another-task - - ^even-another-task - - echo "Both done" another-task: cmds: - - ... - -even-another-task: - cmds: - - ... + - echo "Another task" ``` ### Prevent unnecessary work