Skip to content

Taskfile Scoped Variables #1030

@ameershira

Description

@ameershira

I would like Taskfile scoped variables so that the behaviour of the parent taskfile or the included child taskfiles is not implicitly changed just by including a taskfile. This topic was touched on a few times with @andreynering and the latest discussion is in #1006.

You need this in use cases whereby multiple separate Taskfile projects are chained together in a parent/child relationship. And in this case, you don't own or necessarily know the inner details of these lower-layer included taskfiles.

Currently, you have to know every single variable that is globally scoped so that you don't use the same variable name in the parent or child taskfiles. It kind of defeats the purpose of taskfile inclusion to provide abstraction.

The worst is that if you don't go through every taskfile, you won't know when you are using a variable that changes the behaviour somewhere in some taskfile unintentionally.

@andreynering Thanks for the comment on #1006. I agree that for the next major version making variables scoped by Taskfile is a reasonable consideration and design decision, which would make maintaining taskfiles simpler as the behaviour would be a lot more predictable.

  1. Do you think it's feasible to add a taskfile setting to explicitly enable scoped variables in the current version?
  2. And for the future major version, this could be the default? and perhaps allow variable scope/overriding as an explicit feature?

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: variablesChanges related to variables.breaking changeChanges that are not backward compatible.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions