Is there any way to define a file scoped variable? #981
-
I want to define a variable only can be seen in a Taskfile scope, then the variable can be shared by different task in the single Taskfile, and other Taskfile can also use the same name to refer a different variable. Is there any way to do this? The initiate is that I have a project that need to build multiple packages, the folder structure looks like: topdir/Taskfile.yaml I found if I write the taskfile in the following style: version: '3'
vars:
NAME: 'package1'
tasks:
default:
cmds:
- echo deploy {{.NAME}}
build:
cmds:
- echo build {{.NAME}} The variable |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I ran into this issue a while back. My comment to this is that the behavior is unexpected. The included taskfile behavior should not change implicitly just because its included in another taskfile. |
Beta Was this translation helpful? Give feedback.
I ran into this issue a while back. My comment to this is that the behavior is unexpected. The included taskfile behavior should not change implicitly just because its included in another taskfile.