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

chore: sync translations (#1248)

This commit is contained in:
task-bot 2023-07-02 14:42:10 -03:00 committed by GitHub
parent 788a63ca2f
commit ee2e939d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 267 additions and 42 deletions

View File

@ -74,6 +74,7 @@ A full list of the exit codes and their descriptions can be found below:
| 203 | There a multiple tasks with the same name or alias |
| 204 | A task was called too many times |
| 205 | A task was cancelled by the user |
| 206 | A task was not executed due to missing required variables |
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
@ -212,7 +213,9 @@ vars:
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
@ -312,3 +315,9 @@ tasks:
```
:::
#### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@ -753,6 +753,42 @@ tasks:
- sleep 5 # long operation like installing packages
```
### Ensuring required variables are set
If you want to check that certain variables are set before running a task then you can use `requires`. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
Using `requires` you specify an array of strings in the `vars` sub-section under `requires`, these strings are variable names which are checked prior to running the task. If any variables are un-set the the task will error and not run.
Environmental variables are also checked.
Syntax:
```yaml
requires:
vars: [] # Array of strings
```
:::note
Variables set to empty zero length strings, will pass the `requires` check.
:::
Example of using `requires`:
```yaml
version: '3'
tasks:
docker-build:
cmds:
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
# Make sure these variables are set before running
requires:
vars: [IMAGE_NAME, IMAGE_TAG]
```
## Variables
When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):

View File

@ -74,6 +74,7 @@ A full list of the exit codes and their descriptions can be found below:
| 203 | There a multiple tasks with the same name or alias |
| 204 | A task was called too many times |
| 205 | A task was cancelled by the user |
| 206 | A task was not executed due to missing required variables |
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
@ -212,7 +213,9 @@ vars:
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
@ -312,3 +315,9 @@ tasks:
```
:::
#### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@ -753,6 +753,42 @@ tasks:
- sleep 5 # long operation like installing packages
```
### Ensuring required variables are set
If you want to check that certain variables are set before running a task then you can use `requires`. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
Using `requires` you specify an array of strings in the `vars` sub-section under `requires`, these strings are variable names which are checked prior to running the task. If any variables are un-set the the task will error and not run.
Environmental variables are also checked.
Syntax:
```yaml
requires:
vars: [] # Array of strings
```
:::note
Variables set to empty zero length strings, will pass the `requires` check.
:::
Example of using `requires`:
```yaml
version: '3'
tasks:
docker-build:
cmds:
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
# Make sure these variables are set before running
requires:
vars: [IMAGE_NAME, IMAGE_TAG]
```
## Variables
When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):

View File

@ -74,6 +74,7 @@ Uma lista completa dos códigos de saída e suas descrições podem ser encontra
| 203 | Há várias tarefas com o mesmo nome ou apelido |
| 204 | Uma tarefa foi chamada muitas vezes |
| 205 | A tarefa foi cancelada pelo usuário |
| 206 | A task was not executed due to missing required variables |
Esses códigos também podem ser encontrados no repositório em [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
@ -126,7 +127,7 @@ Há algumas variáveis especiais que são acessíveis via template:
Algumas variáveis de ambiente podem ser configuradas para mudar o comportamento do Task.
| Variável de Ambiente | Padrão | Descrição |
| ENV | Padrão | Descrição |
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `TASK_TEMP_DIR` | `.task` | Caminho da pasta temporária. Pode ser um caminho relativo ao projeto como `tmp/task` ou um caminho absoluto como `/tmp/.task` ou `~/.task`. |
| `TASK_COLOR_RESET` | `0` | Cor utilizada para branco. |
@ -212,7 +213,9 @@ vars:
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
@ -312,3 +315,9 @@ tasks:
```
:::
#### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@ -753,6 +753,42 @@ tasks:
- sleep 5 # long operation like installing packages
```
### Ensuring required variables are set
If you want to check that certain variables are set before running a task then you can use `requires`. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
Using `requires` you specify an array of strings in the `vars` sub-section under `requires`, these strings are variable names which are checked prior to running the task. If any variables are un-set the the task will error and not run.
Environmental variables are also checked.
Syntax:
```yaml
requires:
vars: [] # Array of strings
```
:::note
Variables set to empty zero length strings, will pass the `requires` check.
:::
Example of using `requires`:
```yaml
version: '3'
tasks:
docker-build:
cmds:
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
# Make sure these variables are set before running
requires:
vars: [IMAGE_NAME, IMAGE_TAG]
```
## Variables
When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):

View File

@ -74,6 +74,7 @@ A full list of the exit codes and their descriptions can be found below:
| 203 | There a multiple tasks with the same name or alias |
| 204 | A task was called too many times |
| 205 | A task was cancelled by the user |
| 206 | A task was not executed due to missing required variables |
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
@ -212,7 +213,9 @@ vars:
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
@ -312,3 +315,9 @@ tasks:
```
:::
#### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@ -753,6 +753,42 @@ tasks:
- sleep 5 # long operation like installing packages
```
### Ensuring required variables are set
If you want to check that certain variables are set before running a task then you can use `requires`. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
Using `requires` you specify an array of strings in the `vars` sub-section under `requires`, these strings are variable names which are checked prior to running the task. If any variables are un-set the the task will error and not run.
Environmental variables are also checked.
Syntax:
```yaml
requires:
vars: [] # Array of strings
```
:::note
Variables set to empty zero length strings, will pass the `requires` check.
:::
Example of using `requires`:
```yaml
version: '3'
tasks:
docker-build:
cmds:
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
# Make sure these variables are set before running
requires:
vars: [IMAGE_NAME, IMAGE_TAG]
```
## Variables
When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):

View File

@ -61,19 +61,20 @@ Task 有时会以特定的退出代码退出。 These codes are split into three
可以在下面找到退出代码及其描述的完整列表:
| 代码 | 描述 |
| --- | -------------------------------- |
| 0 | 成功 |
| 1 | 出现未知错误 |
| 100 | 找不到 Taskfile |
| 101 | 尝试初始化一个 Taskfile 时已经存在 |
| 102 | Taskfile 无效或无法解析 |
| 200 | 找不到指定的 task |
| 201 | 在 task 中执行命令时出错 |
| 202 | 用户试图调用内部 task |
| 203 | 有多个具有相同名称或别名的 task |
| 204 | 一个 task 被调用了太多次 |
| 205 | A task was cancelled by the user |
| 代码 | 描述 |
| --- | --------------------------------------------------------- |
| 0 | 成功 |
| 1 | 出现未知错误 |
| 100 | 找不到 Taskfile |
| 101 | 尝试初始化一个 Taskfile 时已经存在 |
| 102 | Taskfile 无效或无法解析 |
| 200 | 找不到指定的 task |
| 201 | 在 task 中执行命令时出错 |
| 202 | 用户试图调用内部 task |
| 203 | 有多个具有相同名称或别名的 task |
| 204 | 一个 task 被调用了太多次 |
| 205 | A task was cancelled by the user |
| 206 | A task was not executed due to missing required variables |
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
@ -126,7 +127,7 @@ When Task is run with the `-x`/`--exit-code` flag, the exit code of any failed c
可以覆盖某些环境变量以调整 Task 行为。
| 环境变量 | 默认 | 描述 |
| ENV | 默认 | 描述 |
| -------------------- | ------- | ------------------------------------------------------------ |
| `TASK_TEMP_DIR` | `.task` | 临时目录的位置。 可以相对于项目比如 `tmp/task` 或绝对如 `/tmp/.task``~/.task`。 |
| `TASK_COLOR_RESET` | `0` | 用于白色的颜色。 |
@ -200,33 +201,35 @@ vars:
### Task
| 属性 | 类型 | 默认 | 描述 |
| --------------- | ---------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `cmds` | [`[]Command`](#command) | | 要执行的 shell 命令列表。 |
| `deps` | [`[]Dependency`](#dependency) | | 此 task 的依赖项列表。 此处定义的 task 将在此 task 之前并行运行。 |
| `label` | `string` | | 运行 task 时覆盖输出中的 task 名称。 支持变量。 |
| `desc` | `string` | | task 的简短描述。 这在调用 `task --list` 时显示。 |
| `prompt` | `string` | | A prompt that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks. |
| `summary` | `string` | | task 的较长描述。 这在调用 `task --summary [task]` 时显示。 |
| `aliases` | `[]string` | | 可以调用 task 的别名列表。 |
| `sources` | `[]string` | | 运行此 task 之前要检查的源列表。 与 `checksum``timestamp` 方法相关。 可以是文件路径或星号。 |
| `generates` | `[]string` | | 此 task 要生成的文件列表。 与 `timestamp` 方法相关。 可以是文件路径或星号。 |
| `status` | `[]string` | | 用于检查此 task 是否应运行的命令列表。 否则跳过该 task。 这个方法会覆盖 `method`、`sources` 和 `generates`。 |
| `preconditions` | [`[]Precondition`](#precondition) | | 用于检查此 task 是否应运行的命令列表。 如果不满足条件,task 将出错。 |
| `dir` | `string` | | 此 task 应运行的目录。 默认为当前工作目录。 |
| `vars` | [`map[string]Variable`](#variable) | | 可在 task 中使用的一组变量。 |
| `env` | [`map[string]Variable`](#variable) | | 一组可用于 shell 命令的环境变量。 |
| `dotenv` | `[]string` | | 要解析的 `.env` 文件路径列表。 |
| `silent` | `bool` | `false` | 从输出中隐藏 task 名称和命令。 命令的输出仍将重定向到 `STDOUT``STDERR`。 当与 `--list` 标志结合使用时,task 描述将被隐藏。 |
| `interactive` | `bool` | `false` | 告诉 task 该命令是交互式的。 |
| `internal` | `bool` | `false` | 停止在命令行上调用 task。 当与 `--list` 一起使用时,它也会从输出中省略。 |
| `method` | `string` | `checksum` | 定义用于检查 task 是最新的方法。 `timestamp` 将比较 sources 的时间戳并生成文件。 `checksum` 将检查 checksum(您可能想忽略 .gitignore 文件中的 .task 文件夹)。 `none` 跳过任何验证并始终运行 task。 |
| `prefix` | `string` | | 定义一个字符串作为并行运行 task 输出的前缀。 仅在输出模式是 `prefixed` 时使用。 |
| `ignore_error` | `bool` | `false` | 如果执行命令时发生错误,则继续执行。 |
| `run` | `string` | Taskfile 中全局声明的值或 `always` | 指定如果多次调用该 task 是否应再次运行。 可用选项:`always`、`once` 和 `when_changed`。 |
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行 task。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/main/src/go/build/syslist.go)。 否则将跳过 task。 |
| `set` | `[]string` | | 为 [内置 `set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) 指定选项。 |
| `shopt` | `[]string` | | 为 [内置 `shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) 指定选项。 |
| 属性 | 类型 | 默认 | 描述 |
| --------------- | ---------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmds` | [`[]Command`](#command) | | 要执行的 shell 命令列表。 |
| `deps` | [`[]Dependency`](#dependency) | | 此 task 的依赖项列表。 此处定义的 task 将在此 task 之前并行运行。 |
| `label` | `string` | | 运行 task 时覆盖输出中的 task 名称。 支持变量。 |
| `desc` | `string` | | task 的简短描述。 这在调用 `task --list` 时显示。 |
| `prompt` | `string` | | A prompt that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks. |
| `summary` | `string` | | task 的较长描述。 这在调用 `task --summary [task]` 时显示。 |
| `aliases` | `[]string` | | 可以调用 task 的别名列表。 |
| `sources` | `[]string` | | 运行此 task 之前要检查的源列表。 与 `checksum``timestamp` 方法相关。 可以是文件路径或星号。 |
| `generates` | `[]string` | | 此 task 要生成的文件列表。 与 `timestamp` 方法相关。 可以是文件路径或星号。 |
| `status` | `[]string` | | 用于检查此 task 是否应运行的命令列表。 否则跳过该 task。 这个方法会覆盖 `method`、`sources` 和 `generates`。 |
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
| `preconditions` | [`[]Precondition`](#precondition) | | 用于检查此 task 是否应运行的命令列表。 如果不满足条件,task 将出错。 |
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
| `dir` | `string` | | 此 task 应运行的目录。 默认为当前工作目录。 |
| `vars` | [`map[string]Variable`](#variable) | | 可在 task 中使用的一组变量。 |
| `env` | [`map[string]Variable`](#variable) | | 一组可用于 shell 命令的环境变量。 |
| `dotenv` | `[]string` | | 要解析的 `.env` 文件路径列表。 |
| `silent` | `bool` | `false` | 从输出中隐藏 task 名称和命令。 命令的输出仍将重定向到 `STDOUT``STDERR`。 当与 `--list` 标志结合使用时,task 描述将被隐藏。 |
| `interactive` | `bool` | `false` | 告诉 task 该命令是交互式的。 |
| `internal` | `bool` | `false` | 停止在命令行上调用 task。 当与 `--list` 一起使用时,它也会从输出中省略。 |
| `method` | `string` | `checksum` | 定义用于检查 task 是最新的方法。 `timestamp` 将比较 sources 的时间戳并生成文件。 `checksum` 将检查 checksum(您可能想忽略 .gitignore 文件中的 .task 文件夹)。 `none` 跳过任何验证并始终运行 task。 |
| `prefix` | `string` | | 定义一个字符串作为并行运行 task 输出的前缀。 仅在输出模式是 `prefixed` 时使用。 |
| `ignore_error` | `bool` | `false` | 如果执行命令时发生错误,则继续执行。 |
| `run` | `string` | Taskfile 中全局声明的值或 `always` | 指定如果多次调用该 task 是否应再次运行。 可用选项:`always`、`once` 和 `when_changed`。 |
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行 task。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/main/src/go/build/syslist.go)。 否则将跳过 task。 |
| `set` | `[]string` | | 为 [内置 `set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) 指定选项。 |
| `shopt` | `[]string` | | 为 [内置 `shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) 指定选项。 |
:::info
@ -312,3 +315,9 @@ tasks:
```
:::
#### Requires
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |

View File

@ -753,6 +753,42 @@ tasks:
- sleep 5 # long operation like installing packages
```
### Ensuring required variables are set
If you want to check that certain variables are set before running a task then you can use `requires`. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
Using `requires` you specify an array of strings in the `vars` sub-section under `requires`, these strings are variable names which are checked prior to running the task. If any variables are un-set the the task will error and not run.
Environmental variables are also checked.
Syntax:
```yaml
requires:
vars: [] # Array of strings
```
:::note
Variables set to empty zero length strings, will pass the `requires` check.
:::
Example of using `requires`:
```yaml
version: '3'
tasks:
docker-build:
cmds:
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
# Make sure these variables are set before running
requires:
vars: [IMAGE_NAME, IMAGE_TAG]
```
## 变量
在进行变量插值时,Task 将查找以下内容。 它们按权重顺序列在下面(即最重要的第一位):