go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.18k stars 595 forks source link

add environment variable-based configuration #1066

Open droopy4096 opened 1 year ago

droopy4096 commented 1 year ago

When using task in larger setups it would be more convenient to pass some of the configuration options via the environment variable so as not to update every line containing task invocation to add or remove options. Consider scenario of having several scripts with contents like:

#!/bin/sh

task target1
#....

task target2

to make them run in dry mode one has to alter all the shell scripts to include --dry option. However with environment variable configuration one can simply:

export TASK_DRY=yes

and run scripts with all task invocations picking up desired option automatically.

Of course --dry is only a sample, control of concurrency between workstation and CI node would be another good example. As well as increasing verbosity while debugging etc.

jwater7 commented 5 months ago

I love this, exactly what I was looking for (specify the taskfile/entrypoint via an env var) - how do we get this in main so we can start using it?

droopy4096 commented 5 months ago

someone will have to review and approve https://github.com/go-task/task/pull/1067