mirror of
https://github.com/go-task/task.git
synced 2026-06-24 05:05:49 +00:00
Rename the experiment from SCOPED_INCLUDES to SCOPED_TASKFILES to better
reflect its expanded scope. This experiment now provides:
1. Variable scoping (existing): includes see only their own vars + parent vars
2. Environment namespace (new): env vars accessible via {{.env.XXX}}
With TASK_X_SCOPED_TASKFILES=1:
- {{.VAR}} accesses vars only (scoped per include)
- {{.env.VAR}} accesses env (OS + Taskfile env:, inherited)
- {{.TASK}} and other special vars remain at root level
This is a breaking change for the experimental feature:
- {{.PATH}} no longer works, use {{.env.PATH}} instead
- Env vars are no longer at root level in templates
25 lines
495 B
YAML
25 lines
495 B
YAML
version: "3"
|
|
|
|
env:
|
|
INC_B_ENV: env_from_b
|
|
SHARED_ENV: shared_from_b
|
|
|
|
vars:
|
|
VAR: value_from_b
|
|
UNIQUE_B: only_in_b
|
|
|
|
tasks:
|
|
print:
|
|
desc: Print vars from include B
|
|
cmds:
|
|
- echo "B:VAR={{.VAR}}"
|
|
- echo "B:UNIQUE_B={{.UNIQUE_B}}"
|
|
- echo "B:ROOT_VAR={{.ROOT_VAR}}"
|
|
|
|
print-env:
|
|
desc: Print env vars from include B
|
|
cmds:
|
|
- echo "B:INC_B_ENV={{.env.INC_B_ENV}}"
|
|
- echo "B:ROOT_ENV={{.env.ROOT_ENV}}"
|
|
- echo "B:SHARED_ENV={{.env.SHARED_ENV}}"
|