Skip to content

Explicit vars? #495

@max-sixty

Description

@max-sixty

Firstly — another thanks for this library! It's much more accessible than make, and others are starting to use it at my company.

Something that can be confusing for users is understanding what variables need to be supplied for a task, without reading the whole task. As a result, I have a convention of listing them explicitly for each task or file, like:

  switch-env:
    vars:
      project: "{{.project}}"
      cluser: "{{.cluster}}"

This works well at the task level, but not the file level. So one question and one feature question:

  • It doesn't seem to work at the file level; i.e. this will pass an empty string for {{project}} when another taskfile sets the var. Removing this definition allows it work. Could I ask why that is?
vars:
  project: "{{.project}}"
  • Is there more general demand for explicitly listing variables by task & file? I would be interested in a strict setting that warned if variables were used implicitly, since it makes them difficult to track.

Thanks again

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions