mirror of
https://github.com/go-task/task.git
synced 2025-04-23 12:18:57 +02:00
On documentation: version: '2' -> version: '3'
This commit is contained in:
parent
6ff3c9015b
commit
6f290f28b6
@ -56,7 +56,7 @@ tasks:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# bad
|
# bad
|
||||||
version: 2
|
version: '3'
|
||||||
includes:
|
includes:
|
||||||
docker: ./docker/Taskfile.yml
|
docker: ./docker/Taskfile.yml
|
||||||
output: prefixed
|
output: prefixed
|
||||||
@ -70,7 +70,7 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
docker: ./docker/Taskfile.yml
|
docker: ./docker/Taskfile.yml
|
||||||
@ -92,7 +92,7 @@ tasks:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# bad
|
# bad
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
foo:
|
foo:
|
||||||
@ -107,7 +107,7 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
foo:
|
foo:
|
||||||
@ -127,7 +127,7 @@ tasks:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# bad
|
# bad
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
binary_name: myapp
|
binary_name: myapp
|
||||||
@ -139,7 +139,7 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
BINARY_NAME: myapp
|
BINARY_NAME: myapp
|
||||||
@ -154,7 +154,7 @@ tasks:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# bad
|
# bad
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
greet:
|
greet:
|
||||||
@ -163,7 +163,7 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
greet:
|
greet:
|
||||||
@ -177,7 +177,7 @@ This convention is also used by most people for any Go templating.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# bad
|
# bad
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
do_something_fancy:
|
do_something_fancy:
|
||||||
@ -186,7 +186,7 @@ tasks:
|
|||||||
|
|
||||||
|
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
do-something-fancy:
|
do-something-fancy:
|
||||||
@ -198,7 +198,7 @@ tasks:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# good
|
# good
|
||||||
version: 2
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
docker:build:
|
docker:build:
|
||||||
|
@ -8,7 +8,7 @@ The example below allows compiling a Go app and uses [Minify][minify] to concat
|
|||||||
and minify multiple CSS files into a single one.
|
and minify multiple CSS files into a single one.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -40,7 +40,7 @@ If you omit a task name, "default" will be assumed.
|
|||||||
You can use `env` to set custom environment variables for a specific task:
|
You can use `env` to set custom environment variables for a specific task:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
greet:
|
greet:
|
||||||
@ -54,7 +54,7 @@ Additionally, you can set globally environment variables, that'll be available
|
|||||||
to all tasks:
|
to all tasks:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GREETING: Hey, there!
|
GREETING: Hey, there!
|
||||||
@ -102,7 +102,7 @@ Example:
|
|||||||
Taskfile.yml:
|
Taskfile.yml:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -113,7 +113,7 @@ tasks:
|
|||||||
Taskfile_linux.yml:
|
Taskfile_linux.yml:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -138,7 +138,7 @@ If you want to share tasks between different projects (Taskfiles), you can use
|
|||||||
the importing mechanism to include other Taskfiles using the `includes` keyword:
|
the importing mechanism to include other Taskfiles using the `includes` keyword:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
docs: ./documentation # will look for ./documentation/Taskfile.yml
|
docs: ./documentation # will look for ./documentation/Taskfile.yml
|
||||||
@ -179,7 +179,7 @@ located. But you can easily make the task run in another folder informing
|
|||||||
`dir`:
|
`dir`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
serve:
|
serve:
|
||||||
@ -201,7 +201,7 @@ You may have tasks that depend on others. Just pointing them on `deps` will
|
|||||||
make them run automatically before running the parent task:
|
make them run automatically before running the parent task:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -220,7 +220,7 @@ In the above example, `assets` will always run right before `build` if you run
|
|||||||
A task can have only dependencies and no commands to group tasks together:
|
A task can have only dependencies and no commands to group tasks together:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
assets:
|
assets:
|
||||||
@ -245,7 +245,7 @@ If you want to pass information to dependencies, you can do that the same
|
|||||||
manner as you would to [call another task](#calling-another-task):
|
manner as you would to [call another task](#calling-another-task):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
@ -269,7 +269,7 @@ often result in a faster build pipeline. But in some situations you may need
|
|||||||
to call other tasks serially. In this case, just use the following syntax:
|
to call other tasks serially. In this case, just use the following syntax:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
main-task:
|
main-task:
|
||||||
@ -291,7 +291,7 @@ Overriding variables in the called task is as simple as informing `vars`
|
|||||||
attribute:
|
attribute:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
main-task:
|
main-task:
|
||||||
@ -320,7 +320,7 @@ If a task generates something, you can inform Task the source and generated
|
|||||||
files, so Task will prevent to run them if not necessary.
|
files, so Task will prevent to run them if not necessary.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -356,7 +356,7 @@ You will probably want to ignore the `.task` folder in your `.gitignore` file
|
|||||||
(It's there that Task stores the last checksum).
|
(It's there that Task stores the last checksum).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -377,7 +377,7 @@ Alternatively, you can inform a sequence of tests as `status`. If no error
|
|||||||
is returned (exit status 0), the task is considered up-to-date:
|
is returned (exit status 0), the task is considered up-to-date:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
generate-files:
|
generate-files:
|
||||||
@ -422,7 +422,7 @@ conditions to be _true_ you can use the `preconditions` stanza.
|
|||||||
expansion and they SHOULD all return 0.
|
expansion and they SHOULD all return 0.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
generate-files:
|
generate-files:
|
||||||
@ -450,7 +450,7 @@ executing tasks that depend on it, a `precondition` will fail a task, along
|
|||||||
with any other tasks that depend on it.
|
with any other tasks that depend on it.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
tasks:
|
tasks:
|
||||||
task_will_fail:
|
task_will_fail:
|
||||||
preconditions:
|
preconditions:
|
||||||
@ -496,7 +496,7 @@ $ task write-file FILE=file.txt "CONTENT=Hello, World!" print "MESSAGE=All done!
|
|||||||
Example of locally declared vars:
|
Example of locally declared vars:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
print-var:
|
print-var:
|
||||||
@ -509,7 +509,7 @@ tasks:
|
|||||||
Example of global vars in a `Taskfile.yml`:
|
Example of global vars in a `Taskfile.yml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
GREETING: Hello from Taskfile!
|
GREETING: Hello from Taskfile!
|
||||||
@ -535,7 +535,7 @@ Variables are expanded 2 times by default. You can change that by setting the
|
|||||||
variables together:
|
variables together:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
expansions: 3
|
expansions: 3
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ The value will be treated as a command and the output assigned. If there is one
|
|||||||
or more trailing newlines, the last newline will be trimmed.
|
or more trailing newlines, the last newline will be trimmed.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -581,7 +581,7 @@ All functions by the Go's [slim-sprig lib](https://go-task.github.io/slim-sprig/
|
|||||||
are available. The following example gets the current date in a given format:
|
are available. The following example gets the current date in a given format:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
print-date:
|
print-date:
|
||||||
@ -607,7 +607,7 @@ Task also adds the following functions:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
print-os:
|
print-os:
|
||||||
@ -635,7 +635,7 @@ Running `task --list` (or `task -l`) lists all tasks with a description.
|
|||||||
The following Taskfile:
|
The following Taskfile:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
@ -670,7 +670,7 @@ Running `task --summary task-name` will show a summary of a task.
|
|||||||
The following Taskfile:
|
The following Taskfile:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
release:
|
release:
|
||||||
@ -739,7 +739,7 @@ Silent mode disables echoing of commands before Task runs it.
|
|||||||
For the following Taskfile:
|
For the following Taskfile:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -765,7 +765,7 @@ There are four ways to enable silent mode:
|
|||||||
* At command level:
|
* At command level:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -777,7 +777,7 @@ tasks:
|
|||||||
* At task level:
|
* At task level:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -789,7 +789,7 @@ tasks:
|
|||||||
* Globally at Taskfile level:
|
* Globally at Taskfile level:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
silent: true
|
silent: true
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ tasks:
|
|||||||
If you want to suppress STDOUT instead, just redirect a command to `/dev/null`:
|
If you want to suppress STDOUT instead, just redirect a command to `/dev/null`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -823,7 +823,7 @@ You have the option to ignore errors during command execution.
|
|||||||
Given the following Taskfile:
|
Given the following Taskfile:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -836,7 +836,7 @@ Task will abort the execution after running `exit 1` because the status code `1`
|
|||||||
However it is possible to continue with execution using `ignore_error`:
|
However it is possible to continue with execution using `ignore_error`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
echo:
|
echo:
|
||||||
@ -867,7 +867,7 @@ options you can choose:
|
|||||||
To choose another one, just set it to root in the Taskfile:
|
To choose another one, just set it to root in the Taskfile:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
output: 'group'
|
output: 'group'
|
||||||
|
|
||||||
@ -884,7 +884,7 @@ tasks:
|
|||||||
with the `prefix:` attribute:
|
with the `prefix:` attribute:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
output: prefixed
|
output: prefixed
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user