rliebz / tusk

The modern task runner
https://rliebz.github.io/tusk/
MIT License
237 stars 21 forks source link

Allow setting environment variables globally #73

Open rliebz opened 4 years ago

rliebz commented 4 years ago

Is your feature request related to a problem? Please describe.

In some cases, it may be desirable to set an environment variable that applies to every task. For example, adding $PWD/.bin to the PATH so that tasks can reference a local version of an executable.

Describe the solution you'd like

Likely another top-level key, environment, that would look like this:

environment:
  PATH: $PWD/.bin:$PATH

This would set the environment variables once at the start of task execution. It might make sense to name the key set-environment for consistency with the task option. The key difference here is that a top-level key could effectively be considered declarative (i.e., it describes the environment), where the task directive is necessarily imperative to resolve ambiguities around what the environment of a sub-task should look like.

Additional context

Related: #72

While this isn't a good fix long-term for specifying an interpreter, it is better ergonomically that what we have now while we figure out a better solution, and it covers a couple other use cases mentioned.