diff --git a/CHANGELOG.md b/CHANGELOG.md index 807f3da2..78ca452b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- Added + [Env Precedence Experiment](https://taskfile.dev/experiments/env-precedence) + (#1038, #1633 by @vmaerten). - Added a CI lint job to ensure that the docs are updated correctly (#1719 by @vmaerten). diff --git a/website/docs/experiments/env_precedence.mdx b/website/docs/experiments/env_precedence.mdx index 1dd3d412..535a676e 100644 --- a/website/docs/experiments/env_precedence.mdx +++ b/website/docs/experiments/env_precedence.mdx @@ -1,5 +1,4 @@ --- -draft: false # Hide in production slug: '/experiments/env-precedence' --- @@ -23,13 +22,15 @@ This experiment breaks the following functionality: :::info -To enable this experiment, set the environment variable: `TASK_X_ENV_PRECEDENCE=1`. -Check out [our guide to enabling experiments ][enabling-experiments] for more -information. +To enable this experiment, set the environment variable: +`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling +experiments][enabling-experiments] for more information. ::: -Before this experiment, the OS variable took precedence over the task environment variable. This experiment changes the precedence to make the task environment variable take precedence over the OS variable. +Before this experiment, the OS variable took precedence over the task +environment variable. This experiment changes the precedence to make the task +environment variable take precedence over the OS variable. Consider the following example: @@ -43,9 +44,11 @@ tasks: cmds: - echo "$KEY" ``` -Running `KEY=some task` before this experiment, the output would be `some`, but after this experiment, the output would be `other`. +Running `KEY=some task` before this experiment, the output would be `some`, but +after this experiment, the output would be `other`. -If you still want to get the OS variable, you can use the template function env like follow : `{{env "OS_VAR"}}`. +If you still want to get the OS variable, you can use the template function env +like follow : `{{env "OS_VAR"}}`. ```yml version: '3' @@ -60,7 +63,8 @@ tasks: ``` Running `KEY=some task`, the output would be `other` and `some`. -Like other variables/envs, you can also fall back to a given value using the default template function: +Like other variables/envs, you can also fall back to a given value using the +default template function: ```yml MY_ENV: '{{.MY_ENV | default "fallback"}}' ```