#324 implement dotenv

This commit is contained in:
Chris Garrett
2020-08-03 16:18:38 -06:00
parent e5a3c861cb
commit 8b962fb8e8
13 changed files with 144 additions and 1 deletions

View File

@@ -33,8 +33,10 @@ executable called must be available by the OS or in PATH.
If you omit a task name, "default" will be assumed.
## Environment
## Environment variables
### Task
You can use `env` to set custom environment variables for a specific task:
```yaml
@@ -66,6 +68,39 @@ tasks:
> NOTE: `env` supports expansion and retrieving output from a shell command
> just like variables, as you can see on the [Variables](#variables) section.
### Operating System
Environment variables from the OS are accessible using `$VARNAME`:
```yaml
version: '2'
tasks:
greet:
cmds:
- echo "Hello $USER"
```
### .env
*.env* files are supported in v3 using the `dotenv` declaration:
.env
```
KEYNAME=VALUE
```
Taskfile.yml
```yaml
version: '3'
dotenv: ['.env']
tasks:
greet:
cmds:
- echo "Using $KEYNAME"
```
## Operating System specific tasks
If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile