1
0
mirror of https://github.com/go-task/task.git synced 2025-07-15 01:35:00 +02:00

Documentation and changelog for global environment variables

This commit is contained in:
Andrey Nering
2019-01-02 13:21:21 -02:00
parent 4ddad68212
commit a42f2af9eb
2 changed files with 29 additions and 6 deletions

View File

@ -5,7 +5,12 @@
- On Windows, Task can now be installed using [Scoop](https://scoop.sh/) - On Windows, Task can now be installed using [Scoop](https://scoop.sh/)
([#152](https://github.com/go-task/task/pull/152)); ([#152](https://github.com/go-task/task/pull/152));
- Fixes issue with file/directory globing - Fixes issue with file/directory globing
([#153](https://github.com/go-task/task/issues/153)). ([#153](https://github.com/go-task/task/issues/153));
- Add ability to globally set environment variables
(
[#138](https://github.com/go-task/task/pull/138),
[#159](https://github.com/go-task/task/pull/159)
).
## v2.2.1 - 2018-12-09 ## v2.2.1 - 2018-12-09

View File

@ -31,23 +31,41 @@ interpreter. So you can write sh/bash commands and it will work even on
Windows, where `sh` or `bash` are usually not available. Just remember any Windows, where `sh` or `bash` are usually not available. Just remember any
executable called must be available by the OS or in PATH. executable called must be available by the OS or in PATH.
If you ommit a task name, "default" will be assumed. If you omit a task name, "default" will be assumed.
## Environment ## Environment
You can specify environment variables that are added when running a command: You can use `env` to set custom environment variables for a specific task:
```yaml ```yaml
version: '2' version: '2'
tasks: tasks:
build: greet:
cmds: cmds:
- echo $hallo - echo $GREETING
env: env:
hallo: welt GREETING: Hey, there!
``` ```
Additionally, you can set globally environment variables, that'll be available
to all tasks:
```yaml
version: '2'
env:
GREETING: Hey, there!
tasks:
greet:
cmds:
- echo $GREETING
```
> NOTE: `env` supports expansion and and retrieving output from a shell command
> just like variables, as you can see on the [Variables](#variables) section.
## Operating System specific tasks ## Operating System specific tasks
If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile