1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00

docs: optimize document structure (#1074)

This commit is contained in:
Misite Bao 2023-03-26 03:09:31 +08:00 committed by GitHub
parent 738ffde962
commit d72eb009e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
---
slug: /api/
sidebar_position: 4
toc_min_heading_level: 2
toc_max_heading_level: 5
---
# API Reference
@ -103,9 +105,7 @@ Some environment variables can be overriden to adjust Task behavior.
| `TASK_COLOR_RED` | `31` | Color used for red. |
| `FORCE_COLOR` | | Force color output usage. |
## Schema
### Taskfile
## Taskfile Schema
| Attribute | Type | Default | Description |
| - | - | - | - |
@ -145,6 +145,26 @@ includes:
:::
### Variable
| Attribute | Type | Default | Description |
| - | - | - | - |
| *itself* | `string` | | A static value that will be set to the variable. |
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
:::info
Static and dynamic variables have different syntaxes, like below:
```yaml
vars:
STATIC: static
DYNAMIC:
sh: echo "dynamic"
```
:::
### Task
| Attribute | Type | Default | Description |
@ -193,27 +213,7 @@ tasks:
:::
### Dependency
| Attribute | Type | Default | Description |
| - | - | - | - |
| `task` | `string` | | The task to be execute as a dependency. |
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
:::tip
If you don't want to set additional variables, it's enough to declare the
dependency as a list of strings (they will be assigned to `task`):
```yaml
tasks:
foo:
deps: [foo, bar]
```
:::
### Command
#### Command
| Attribute | Type | Default | Description |
| - | - | - | - |
@ -241,27 +241,27 @@ tasks:
:::
### Variable
#### Dependency
| Attribute | Type | Default | Description |
| - | - | - | - |
| *itself* | `string` | | A static value that will be set to the variable. |
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
| `task` | `string` | | The task to be execute as a dependency. |
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
:::info
:::tip
Static and dynamic variables have different syntaxes, like below:
If you don't want to set additional variables, it's enough to declare the
dependency as a list of strings (they will be assigned to `task`):
```yaml
vars:
STATIC: static
DYNAMIC:
sh: echo "dynamic"
tasks:
foo:
deps: [foo, bar]
```
:::
### Precondition
#### Precondition
| Attribute | Type | Default | Description |
| - | - | - | - |