You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes my taskfiles and scripts they call require both vars and env to be set to the same values. You can imagine a cmd using a var {{.VAR}} and the script it calls (or envsubst) also using the same var but as env $VAR.
It would be great if there was a way to easily have env inherit vars set on a task.
TASK_X_MAP_VARIABLES=0 task test
err: maps cannot be assigned to variables
file: /tmp/Taskfile.yaml:8:11
6 | - echo "using vars {{.FOO}}"
7 | - echo "using env $FOO and $FIZZ"
> 8 | vars: &vars
| ^
9 | FOO: bar
10 | env:
TASK_X_MAP_VARIABLES=1 task test
task: [test] echo "using vars bar"
using vars bar
task: [test] echo "using env $FOO and $FIZZ"
using env and buzz
task: [test] cat test.txt | envsubst
:buzz
Purposed solution
Even if the above worked, it would still be great to have the below to avoid the anchor/alias jank.
version: '3'tasks:
test:
cmds:
- echo "using vars {{.FOO}}"
- echo "using env $FOO and $FIZZ"
- cat test.txt | envsubst # test.txt has content '$FOO:$FIZZ'vars:
FOO: barenvFromVars: true # assign all vars to envenv:
FIZZ: buzz # and also allow adding other env
Expected Output
task test
task: [test] echo "using vars bar"
using vars bar
task: [test] echo "using env $FOO and $FIZZ"
using env bar and buzz
task: [test] cat test.txt | envsubst
bar:buzz
The text was updated successfully, but these errors were encountered:
Hi 👋🏼
Sometimes my taskfiles and scripts they call require both vars and env to be set to the same values. You can imagine a cmd using a var
{{.VAR}}
and the script it calls (or envsubst) also using the same var but as env$VAR
.It would be great if there was a way to easily have env inherit vars set on a task.
Current issue
Output with various
TASK_X_MAP_VARIABLES
Purposed solution
Even if the above worked, it would still be great to have the below to avoid the anchor/alias jank.
Expected Output
The text was updated successfully, but these errors were encountered: