From 6733ef458f22d7db95b651b439551c2e8d4a8fda Mon Sep 17 00:00:00 2001 From: Sascha Andres Date: Thu, 2 Mar 2017 20:34:35 +0100 Subject: [PATCH] Explained usage of set with multiple commands --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50f18647..4c516a41 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,32 @@ You can use environment variables, task level variables and a file called `Varia They are evaluated in the following order: -Task local variables are overwritten by variables found in `Variables`. Variables found in `Variables` are overwritten with variables from the environment. +Task local variables are overwritten by variables found in `Variables`. Variables found in `Variables` are overwritten with variables from the environment. The output of the last command is stored in the environment. So you can do something like this: + +```yml +build: + deps: [setvar] + cmds: + - echo "{{prefix}} '{{THEVAR}}'" + variables: + prefix: "Result: " + +setvar: + cmds: + - echo -n "a" + - echo -n "{{THEVAR}}b" + - echo -n "{{THEVAR}}c" + set: THEVAR +``` + +The result of a run of build would be: + +``` +a +ab +abc +Result: 'abc' +``` ### Task dependencies