From d8a12fe56d987c010a3291b410dc4aecdbeebf82 Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Sun, 18 Jun 2023 02:04:05 +0100 Subject: [PATCH] Support for experiment env vars (#1214) * feat: experiments env var handling * feat: read experiments from dotenv files * docs: removed experimental cli flags * feat: use vars instead of struct with reflection --- docs/docs/experiments/experiments.md | 24 ++++++++++------ internal/experiments/experiments.go | 43 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 internal/experiments/experiments.go diff --git a/docs/docs/experiments/experiments.md b/docs/docs/experiments/experiments.md index ab99016d..8d337b96 100644 --- a/docs/docs/experiments/experiments.md +++ b/docs/docs/experiments/experiments.md @@ -21,13 +21,19 @@ are intended to replace. You can enable an experimental feature by: -1. Using the `--x-{feature}` flag. This is intended for one-off invocations of - Task to test out experimental features. You can also disable a feature by - specifying a falsy value such as `--x-{feature}=false`. -1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for - permanently enabling experimental features in your environment. +1. Using the relevant environment variable in front of a task command. For + example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off + invocations of Task to test out experimental features. +1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, + `.zshrc` etc.). This is intended for permanently enabling experimental + features in your environment. +1. Creating a `.env` file in the same directory as your root Taskfile that + contains the relevant environment variables. e.g. -Flags will always override environment variables. +```shell +# .env +TASK_X_FEATURE=1 +``` ## Current Experimental Features and Deprecations @@ -38,11 +44,11 @@ existing Taskfiles to the new behavior.