mirror of
https://github.com/go-task/task.git
synced 2024-12-12 10:45:49 +02:00
Website: Sync translations (#1123)
This commit is contained in:
parent
c2523796c0
commit
44b5b1b6ed
@ -5,11 +5,11 @@ toc_min_heading_level: 2
|
||||
toc_max_heading_level: 5
|
||||
---
|
||||
|
||||
# API Reference
|
||||
# Referência da API
|
||||
|
||||
## CLI
|
||||
|
||||
Task command line tool has the following syntax:
|
||||
O comando "task" tem a seguinte sintaxe:
|
||||
|
||||
```bash
|
||||
task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
@ -17,44 +17,71 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If `--` is given, all remaning arguments will be assigned to a special `CLI_ARGS` variable
|
||||
Se `--` é informado, todos os argumentos remanescentes serão atribuídos a uma variável especial chamada `CLI_ARGS`
|
||||
|
||||
:::
|
||||
|
||||
| Abreviação | Modificador | Tipo | Predefinição | Descrição |
|
||||
| ---------- | --------------------------- | -------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `-c` | `--color` | `bool` | `true` | Saída colorida. Habilitado por padrão. Defina o modificador como `false` ou use `NO_COLOR=1` para desativar. |
|
||||
| `-C` | `--concurrency` | `int` | `0` | Limitar número de tarefas a serem executadas simultaneamente. Zero significa ilimitado. |
|
||||
| `-d` | `--dir` | `string` | Pasta atual | Define a pasta de execução. |
|
||||
| `-n` | `--dry` | `bool` | `false` | Compila e imprime as tarefas na ordem em que elas seriam executadas, sem executá-las. |
|
||||
| `-x` | `--exit-code` | `bool` | `false` | Faz com que o código de saída do comando sendo executado seja repassado pelo Task. |
|
||||
| `-f` | `--force` | `bool` | `false` | Força a execução mesmo quando a tarefa está atualizada. |
|
||||
| `-g` | `--global` | `bool` | `false` | Executa o Taskfile global, de `$HOME/Taskfile.{yml,yaml}`. |
|
||||
| `-h` | `--help` | `bool` | `false` | Mostra a ajuda do Task. |
|
||||
| `-i` | `--init` | `bool` | `false` | Cria um novo Taskfile.yml na pasta atual. |
|
||||
| `-I` | `--interval` | `string` | `5s` | Define um intervalo de tempo diferente ao usar `--watch`, o padrão sendo 5 segundos. Este valor deve ser um [Go Duration](https://pkg.go.dev/time#ParseDuration) válido. |
|
||||
| `-l` | `--list` | `bool` | `false` | Lista as tarefas com descrição do Taskfile atual. |
|
||||
| `-a` | `--list-all` | `bool` | `false` | Lista todas as tarefas, com ou sem descrição. |
|
||||
| | `--sort` | `string` | `default` | Altera a ordem das tarefas quando listadas. |
|
||||
| | `--json` | `bool` | `false` | Imprime a saída em [JSON](#json-output). |
|
||||
| `-o` | `--output` | `string` | O padrão é o que está definido no Taskfile, ou então `intervealed`. | Configura o estilo de saída: [`interleaved`/`group`/`prefixed`]. |
|
||||
| | `--output-group-begin` | `string` | | Formato de mensagem a imprimir antes da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-end` | `string` | | Formato de mensagem a imprimir depois da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-error-only` | `bool` | `false` | Oculta saída dos comandos que terminarem sem erro. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executa as tarefas fornecidas na linha de comando em paralelo. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Desabilita impressão. |
|
||||
| | `--status` | `bool` | `false` | Sai com código de saída diferente de zero se alguma das tarefas especificadas não estiver atualizada. |
|
||||
| | `--summary` | `bool` | `false` | Mostrar resumo sobre uma tarefa. |
|
||||
| `-t` | `--taskfile` | `string` | `Taskfile.yml` ou `Taskfile.yaml` | |
|
||||
| `-v` | `--verbose` | `bool` | `false` | Habilita modo verboso. |
|
||||
| | `--version` | `bool` | `false` | Mostrar versão do Task. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Habilita o monitoramento de tarefas. |
|
||||
|
||||
| Short | Flag | Type | Default | Description |
|
||||
| ----- | --------------------------- | -------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | Colored output. Enabled by default. Set flag to `false` or use `NO_COLOR=1` to disable. |
|
||||
| `-C` | `--concurrency` | `int` | `0` | Limit number tasks to run concurrently. Zero means unlimited. |
|
||||
| `-d` | `--dir` | `string` | Working directory | Sets directory of execution. |
|
||||
| `-n` | `--dry` | `bool` | `false` | Compiles and prints tasks in the order that they would be run, without executing them. |
|
||||
| `-x` | `--exit-code` | `bool` | `false` | Pass-through the exit code of the task command. |
|
||||
| `-f` | `--force` | `bool` | `false` | Forces execution even when the task is up-to-date. |
|
||||
| `-g` | `--global` | `bool` | `false` | Runs global Taskfile, from `$HOME/Taskfile.{yml,yaml}`. |
|
||||
| `-h` | `--help` | `bool` | `false` | Shows Task usage. |
|
||||
| `-i` | `--init` | `bool` | `false` | Creates a new Taskfile.yml in the current folder. |
|
||||
| `-I` | `--interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
|
||||
| `-l` | `--list` | `bool` | `false` | Lists tasks with description of current Taskfile. |
|
||||
| `-a` | `--list-all` | `bool` | `false` | Lists tasks with or without a description. |
|
||||
| | `--sort` | `string` | `default` | Changes the order of the tasks when listed. |
|
||||
| | `--json` | `bool` | `false` | See [JSON Output](#json-output) |
|
||||
| `-o` | `--output` | `string` | Default set in the Taskfile or `intervealed` | Sets output style: [`interleaved`/`group`/`prefixed`]. |
|
||||
| | `--output-group-begin` | `string` | | Message template to print before a task's grouped output. |
|
||||
| | `--output-group-end` | `string` | | Message template to print after a task's grouped output. |
|
||||
| | `--output-group-error-only` | `bool` | `false` | Swallow command output on zero exit code. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executes tasks provided on command line in parallel. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Disables echoing. |
|
||||
| | `--status` | `bool` | `false` | Exits with non-zero exit code if any of the given tasks is not up-to-date. |
|
||||
| | `--summary` | `bool` | `false` | Show summary about a task. |
|
||||
| `-t` | `--taskfile` | `string` | `Taskfile.yml` or `Taskfile.yaml` | |
|
||||
| `-v` | `--verbose` | `bool` | `false` | Enables verbose mode. |
|
||||
| | `--version` | `bool` | `false` | Show Task version. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Enables watch of the given task. |
|
||||
## Códigos de saída
|
||||
|
||||
## JSON Output
|
||||
O Task às vezes fecha com códigos de saída específicos. Estes códigos são divididos em três grupos com os seguintes intervalos:
|
||||
|
||||
When using the `--json` flag in combination with either the `--list` or `--list-all` flags, the output will be a JSON object with the following structure:
|
||||
- Erros gerais (0-99)
|
||||
- Erros de Taskfile (100-199)
|
||||
- Erros de execução de tarefa (200-299)
|
||||
|
||||
Uma lista completa dos códigos de saída e suas descrições podem ser encontradas abaixo:
|
||||
|
||||
| Código | Descrição |
|
||||
| ------ | ----------------------------------------------------------- |
|
||||
| 0 | Sucesso |
|
||||
| 1 | Um erro desconhecido ocorreu |
|
||||
| 100 | Nenhum Arquivo foi encontrado |
|
||||
| 101 | Um arquivo Taskfile já existe ao tentar inicializar um |
|
||||
| 102 | O arquivo Taskfile é inválido ou não pode ser analisado |
|
||||
| 200 | A tarefa especificada não pôde ser encontrada |
|
||||
| 201 | Ocorreu um erro ao executar um comando dentro de uma tarefa |
|
||||
| 202 | O usuário tentou invocar uma tarefa que é interna |
|
||||
| 203 | Há várias tarefas com o mesmo nome ou apelido |
|
||||
| 204 | Uma tarefa foi chamada muitas vezes |
|
||||
|
||||
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).
|
||||
|
||||
:::info
|
||||
Quando o Task é executado com o modificador `-x`/`--exit-code`, o código de saída de todos os comandos falhados será passado para o usuário.
|
||||
:::
|
||||
|
||||
## Saída em JSON
|
||||
|
||||
Quando estiver usando o modificador `--json` em combinação com o modificador `--list` ou `--list-all`, a saída será um objeto JSON com a seguinte estrutura:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
@ -76,7 +103,7 @@ When using the `--json` flag in combination with either the `--list` or `--list-
|
||||
}
|
||||
```
|
||||
|
||||
## Special Variables
|
||||
## Variáveis Especiais
|
||||
|
||||
There are some special variables that is available on the templating system:
|
||||
|
||||
@ -138,7 +165,6 @@ Some environment variables can be overriden to adjust Task behavior.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Informing only a string like below is equivalent to setting that value to the `taskfile` attribute.
|
||||
|
||||
```yaml
|
||||
@ -148,7 +174,6 @@ includes:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Variable
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -158,7 +183,6 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Static and dynamic variables have different syntaxes, like below:
|
||||
|
||||
```yaml
|
||||
@ -170,7 +194,6 @@ vars:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Task
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -196,13 +219,12 @@ vars:
|
||||
| `prefix` | `string` | | Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing commands. |
|
||||
| `run` | `string` | The one declared globally in the Taskfile or `always` | Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the task should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/go/build/syslist.go). Task will be skipped otherwise. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the task should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/main/src/go/build/syslist.go). Task will be skipped otherwise. |
|
||||
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
These alternative syntaxes are available. They will set the given values to `cmds` and everything else will be set to their default values:
|
||||
|
||||
```yaml
|
||||
@ -219,24 +241,22 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Command
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| -------------- | ---------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -------------- | ---------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cmd` | `string` | | The shell command to be executed. |
|
||||
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
|
||||
| `task` | `string` | | Set this to trigger execution of another task instead of running a command. This cannot be set together with `cmd`. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the referenced task. Only relevant when setting `task` instead of `cmd`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing the command. |
|
||||
| `defer` | `string` | | Alternative to `cmd`, but schedules the command to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/go/build/syslist.go). Command will be skipped otherwise. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/main/src/go/build/syslist.go). Command will be skipped otherwise. |
|
||||
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
If given as a a string, the value will be assigned to `cmd`:
|
||||
|
||||
```yaml
|
||||
@ -249,7 +269,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Dependency
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -259,7 +278,6 @@ tasks:
|
||||
|
||||
:::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
|
||||
@ -270,7 +288,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Precondition
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -280,7 +297,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If you don't want to set a different message, you can declare a precondition like this and the value will be assigned to `sh`:
|
||||
|
||||
```yaml
|
||||
|
@ -5,6 +5,17 @@ sidebar_position: 7
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.24.0 - 2023-04-15
|
||||
|
||||
- Fix Fish shell completion for tasks with aliases ([#1113](https://github.com/go-task/task/issues/1113) by [@patricksjackson](https://github.com/patricksjackson)).
|
||||
- The default branch was renamed from `master` to `main` ([#1049](https://github.com/go-task/task/issues/1049), [#1048](https://github.com/go-task/task/issues/1048) by [@pd93](https://github.com/pd93)).
|
||||
- Fix bug where "up-to-date" logs were not being omitted for silent tasks ([#546](https://github.com/go-task/task/issues/546), [#1107](https://github.com/go-task/task/issues/1107) by [@danquah](https://github.com/danquah)).
|
||||
- Add `.hg` (Mercurial) to the list of ignored directories when using `--watch` ([#1098](https://github.com/go-task/task/issues/1098) by [@misery](https://github.com/misery)).
|
||||
- More improvements to the release tool ([#1096](https://github.com/go-task/task/issues/1096) by [@pd93](https://github.com/pd93)).
|
||||
- Enforce [gofumpt](https://github.com/mvdan/gofumpt) linter ([#1099](https://github.com/go-task/task/issues/1099) by [@pd93](https://github.com/pd93))
|
||||
- Add `--sort` flag for use with `--list` and `--list-all` ([#946](https://github.com/go-task/task/issues/946), [#1105](https://github.com/go-task/task/issues/1105) by [@pd93](https://github.com/pd93)).
|
||||
- Task now has [custom exit codes](https://taskfile.dev/api/#exit-codes) depending on the error ([#1114](https://github.com/go-task/task/issues/1114) by [@pd93](https://github.com/pd93)).
|
||||
|
||||
## v3.23.0 - 2023-03-26
|
||||
|
||||
Task now has an [official extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=task.vscode-task) contributed by [@pd93](https://github.com/pd93)! :tada: The extension is maintained in a [new repository](https://github.com/go-task/vscode-task) under the `go-task` organization. We're looking to gather feedback from the community so please give it a go and let us know what you think via a [discussion](https://github.com/go-task/vscode-task/discussions), [issue](https://github.com/go-task/vscode-task/issues) or on our [Discord](https://discord.gg/6TY36E39UK)!
|
||||
@ -14,8 +25,7 @@ Task now has an [official extension for Visual Studio Code](https://marketplace.
|
||||
- The website was integrated with [Crowdin](https://crowdin.com/project/taskfile) to allow the community to contribute with translations! [Chinese](https://taskfile.dev/zh-Hans/) is the first language available ([#1057](https://github.com/go-task/task/issues/1057), [#1058](https://github.com/go-task/task/issues/1058) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added task location data to the `--json` flag output ([#1056](https://github.com/go-task/task/issues/1056) by [@pd93](https://github.com/pd93))
|
||||
- Change the name of the file generated by `task --init` from `Taskfile.yaml` to `Taskfile.yml` ([#1062](https://github.com/go-task/task/issues/1062) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar
|
||||
baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Fix the value of `{{.CHECKSUM}}` variable in status ([#1076](https://github.com/go-task/task/issues/1076), [#1080](https://github.com/go-task/task/issues/1080) by [@pd93](https://github.com/pd93)).
|
||||
- Fixed deep copy implementation ([#1072](https://github.com/go-task/task/issues/1072) by [@pd93](https://github.com/pd93))
|
||||
- Created a tool to assist with releases ([#1086](https://github.com/go-task/task/issues/1086) by [@pd93](https://github.com/pd93)).
|
||||
@ -40,8 +50,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
- Improve behavior and performance of status checking when using the `timestamp` mode ([#976](https://github.com/go-task/task/issues/976), [#977](https://github.com/go-task/task/issues/977) by [@aminya](https://github.com/aminya)).
|
||||
- Performance optimizations were made for large Taskfiles ([#982](https://github.com/go-task/task/issues/982) by [@pd93](https://github.com/pd93)).
|
||||
- Add ability to configure options for the [`set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) and [`shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) builtins ([#908](https://github.com/go-task/task/issues/908), [#929](https://github.com/go-task/task/issues/929) by [@pd93](https://github.com/pd93), [Documentation](http://taskfile.dev/usage/#set-and-shopt)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms:
|
||||
[linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms: [linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
|
||||
## v3.19.1 - 2022-12-31
|
||||
|
||||
@ -151,8 +160,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
|
||||
## v3.9.0 - 2021-10-02
|
||||
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a
|
||||
string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with some small fixes and features
|
||||
- The `read -p` flag is now supported ([#314](https://github.com/go-task/task/issues/314), [mvdan/sh\[#551\](https://github.com/go-task/task/issues/551)](https://github.com/mvdan/sh/issues/551), [mvdan/sh\[#772\](https://github.com/go-task/task/issues/772)](https://github.com/mvdan/sh/pull/722))
|
||||
- The `pwd -P` and `pwd -L` flags are now supported ([#553](https://github.com/go-task/task/issues/553), [mvdan/sh\[#724\](https://github.com/go-task/task/issues/724)](https://github.com/mvdan/sh/issues/724), [mvdan/sh\[#728\](https://github.com/go-task/task/issues/728)](https://github.com/mvdan/sh/pull/728))
|
||||
@ -327,7 +335,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
- Added support for [including other Taskfiles](https://taskfile.org/#/usage?id=including-other-taskfiles) ([#98](https://github.com/go-task/task/issues/98))
|
||||
- This should be considered experimental. For now, only including local files is supported, but support for including remote Taskfiles is being discussed. If you have any feedback, please comment on [#98](https://github.com/go-task/task/issues/98).
|
||||
- Task now have a dedicated documentation site: https://taskfile.org
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/master/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/main/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
|
||||
## v2.1.1 - 2018-09-17
|
||||
|
||||
@ -359,7 +367,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
|
||||
Version 2.0.0 is here, with a new Taskfile format.
|
||||
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/master/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/main/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
|
||||
- New Taskfile version 2 ([#77](https://github.com/go-task/task/issues/77))
|
||||
- Possibility to have global variables in the `Taskfile.yml` instead of `Taskvars.yml` ([#66](https://github.com/go-task/task/issues/66))
|
||||
|
@ -15,7 +15,7 @@ Some of the work to improve the Task ecosystem is done by the community, be it i
|
||||
|
||||
### JSON Schema
|
||||
|
||||
Initial work on the schema was made by [@KROSF](https://github.com/KROSF) on [this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895). The schema is currently available at https://taskfile.dev/schema.json and linked at https://json.schemastore.org/taskfile.json so it is be used automatically many code editors, like VSCode. Contributions can be done by editing [this file](https://github.com/go-task/task/blob/master/docs/static/schema.json).
|
||||
Initial work on the schema was made by [@KROSF](https://github.com/KROSF) on [this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895). The schema is currently available at https://taskfile.dev/schema.json and linked at https://json.schemastore.org/taskfile.json so it is be used automatically many code editors, like VSCode. Contributions can be done by editing [this file](https://github.com/go-task/task/blob/main/docs/static/schema.json).
|
||||
|
||||
### Visual Studio Code extension
|
||||
|
||||
|
@ -14,9 +14,9 @@ Contributions to Task are very welcome, but we ask that you read this document b
|
||||
|
||||
## 1. Setup
|
||||
|
||||
- **Go** - Task is written in [Go](https://go.dev). We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js](https://nodejs.org/en/) is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn](https://yarnpkg.com/) is the Node.js package manager used by Task.
|
||||
- **Go** - Task is written in [Go][go]. We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js][nodejs] is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn][yarn] is the Node.js package manager used by Task.
|
||||
|
||||
## 2. Making changes
|
||||
|
||||
@ -30,11 +30,11 @@ To run Task with working changes, you can use `go run ./cmd/task`. To run a deve
|
||||
|
||||
### Updating documentation
|
||||
|
||||
Task uses [Docusaurus](https://docusaurus.io) to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
Task uses [Docusaurus][docusaurus] to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
|
||||
When making a change, consider whether a change to the [Usage Guide](./usage.md) is necessary. This document contains descriptions and examples of how to use Task features. If you're adding a new feature, try to find an appropriate place to add a new section. If you're updating an existing feature, ensure that the documentation and any examples are up-to-date. Ensure that any examples follow the [Taskfile Styleguide](./styleguide.md).
|
||||
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema](https://github.com/go-task/task/blob/master/docs/static/schema.json). The descriptions for fields in the API reference and the schema should match.
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema][json-schema]. The descriptions for fields in the API reference and the schema should match.
|
||||
|
||||
### Writing tests
|
||||
|
||||
@ -57,16 +57,25 @@ Try to write meaningful commit messages and avoid having too many commits on the
|
||||
|
||||
> I want to contribute, where do I start?
|
||||
|
||||
Take a look at the list of [open issues](https://github.com/go-task/task/issues). We have a [good first issue](https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label for simpler issues that are ideal for first time contributions.
|
||||
Take a look at the list of [open issues][open-issues]. We have a [good first issue][good-first-issue] label for simpler issues that are ideal for first time contributions.
|
||||
|
||||
All kinds of contributions are welcome, whether its a typo fix or a shiny new feature. You can also contribute by upvoting/commenting on issues, helping to answer questions or contributing to other [community projects](./community.md).
|
||||
|
||||
> I'm stuck, where can I get help?
|
||||
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server](https://discord.gg/6TY36E39UK) or open a [Discussion](https://github.com/go-task/task/discussions) on GitHub.
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server][discord-server] or open a [Discussion][discussion] on GitHub.
|
||||
|
||||
---
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://go.dev
|
||||
[nodejs]: https://nodejs.org/en/
|
||||
[yarn]: https://yarnpkg.com/
|
||||
[docusaurus]: https://docusaurus.io
|
||||
[json-schema]: https://github.com/go-task/task/blob/main/docs/static/schema.json
|
||||
[open-issues]: https://github.com/go-task/task/issues
|
||||
[good-first-issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
[discord-server]: https://discord.gg/6TY36E39UK
|
||||
[discussion]: https://github.com/go-task/task/discussions
|
||||
|
@ -9,11 +9,11 @@ Se você acha esse projeto útil, considere doar usando um dos meios listados ab
|
||||
|
||||
Esta é apenas uma maneira de dizer "obrigado", ele não lhe dará nenhum benefício como maior prioridade em issues ou algo parecido.
|
||||
|
||||
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in the website homepage and on the GitHub repository README. Make contact with [@andreynering](https://github.com/andreynering) with the logo you want to be shown. Suspect businesses (gambling, casinos, etc) won't be allowed, though.
|
||||
As empresas que doarem pelo menos $50/mês ganharão destaque como "Patrocinador Ouro" na página do site e no README do repositório no GitHub. Faça contato com [@andreynering][] com o logotipo que você deseja ser mostrado no site. Negócios suspeitos (apostas, cassinos, etc) não serão permitidos, porém.
|
||||
|
||||
## GitHub Sponsors
|
||||
|
||||
A forma sugerida de doar para os mantenedores é através do GitHub Sponsors. Just use the following links to do your donation:
|
||||
A forma sugerida de doar para os mantenedores é através do GitHub Sponsors. Basta usar os seguintes links para fazer a sua doação:
|
||||
|
||||
- [@andreynering](https://github.com/sponsors/andreynering)
|
||||
- [@pd93](https://github.com/sponsors/pd93)
|
||||
@ -30,14 +30,15 @@ Se você preferir o [Open Collective](https://opencollective.com/task) você pod
|
||||
|
||||
## PayPal
|
||||
|
||||
You can donate to [@andreynering](https://github.com/andreynering) via PayPal as well:
|
||||
Você pode doar para [@andreynering][] através do PayPal também:
|
||||
|
||||
- [Qualquer valor - Doação única](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url)
|
||||
|
||||
## PIX (somente para o Brasil)
|
||||
|
||||
And if you're Brazilian, you can also donate to [@andreynering](https://github.com/andreynering) via PIX by [using this QR Code](/img/pix.png).
|
||||
E se você é brasileiro, também pode doar para [@andreynering][] via PIX [usando este QR Code](/img/pix.png).
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[@andreynering]: https://github.com/andreynering
|
||||
|
@ -31,7 +31,7 @@ The default shell on Windows (`cmd` and `powershell`) do not have commands like
|
||||
|
||||
- Use the `{{OS}}` function to run an OS-specific script.
|
||||
- Use something like `{{if eq OS "windows"}}powershell {{end}}<my_cmd>` to detect windows and run the command in Powershell directly.
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash](https://gitforwindows.org/) or [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash][git-bash] or [WSL][wsl].
|
||||
|
||||
We want to make improvements to this part of Task and the issues below track this work. Constructive comments and contributions are very welcome!
|
||||
|
||||
@ -42,3 +42,5 @@ We want to make improvements to this part of Task and the issues below track thi
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[git-bash]: https://gitforwindows.org/
|
||||
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
|
||||
|
@ -11,7 +11,7 @@ Task offers many installation methods. Check out the available methods below.
|
||||
|
||||
### Homebrew
|
||||
|
||||
If you're on macOS or Linux and have [Homebrew](https://brew.sh/) installed, getting Task is as simple as running:
|
||||
If you're on macOS or Linux and have [Homebrew][homebrew] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
brew install go-task/tap/go-task
|
||||
@ -27,7 +27,7 @@ brew install go-task
|
||||
|
||||
### Snap
|
||||
|
||||
Task is available in [Snapcraft](https://snapcraft.io/task), but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
Task is available in [Snapcraft][snapcraft], but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
|
||||
```bash
|
||||
sudo snap install task --classic
|
||||
@ -35,7 +35,7 @@ sudo snap install task --classic
|
||||
|
||||
### Chocolatey
|
||||
|
||||
If you're on Windows and have [Chocolatey](https://chocolatey.org/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Chocolatey][choco] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
choco install go-task
|
||||
@ -45,7 +45,7 @@ This installation method is community owned.
|
||||
|
||||
### Scoop
|
||||
|
||||
If you're on Windows and have [Scoop](https://scoop.sh/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Scoop][scoop] installed, getting Task is as simple as running:
|
||||
|
||||
```cmd
|
||||
scoop install task
|
||||
@ -109,7 +109,7 @@ winget install Task.Task
|
||||
|
||||
### Binary
|
||||
|
||||
You can download the binary from the [releases page on GitHub](https://github.com/go-task/task/releases) and add to your `$PATH`.
|
||||
You can download the binary from the [releases page on GitHub][releases] and add to your `$PATH`.
|
||||
|
||||
DEB and RPM packages are also available.
|
||||
|
||||
@ -117,7 +117,7 @@ The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
||||
|
||||
### Install Script
|
||||
|
||||
We also have an [install script](https://github.com/go-task/task/blob/master/install-task.sh) which is very useful in scenarios like CI. Many thanks to [GoDownloader](https://github.com/goreleaser/godownloader) for enabling the easy generation of this script.
|
||||
We also have an [install script][installscript] which is very useful in scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the easy generation of this script.
|
||||
|
||||
By default, it installs on the `./bin` directory relative to the working directory:
|
||||
|
||||
@ -133,12 +133,10 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
|
||||
:::caution
|
||||
|
||||
|
||||
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by default.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
If you want to install Task in GitHub Actions you can try using [this action](https://github.com/arduino/setup-task) by the Arduino team:
|
||||
@ -157,7 +155,7 @@ This installation method is community owned.
|
||||
|
||||
### Go Modules
|
||||
|
||||
Ensure that you have a supported version of [Go](https://golang.org/) properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/master/go.mod#L3) file.
|
||||
Ensure that you have a supported version of [Go][go] properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
|
||||
|
||||
You can then install the latest release globally by running:
|
||||
|
||||
@ -173,17 +171,15 @@ env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
For CI environments we recommend using the [install script](#install-script) instead, which is faster and more stable, since it'll just download the latest released binary.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Setup completions
|
||||
|
||||
Download the autocompletion file corresponding to your shell.
|
||||
|
||||
[All completions are available on the Task repository](https://github.com/go-task/task/tree/master/completion).
|
||||
[All completions are available on the Task repository](https://github.com/go-task/task/tree/main/completion).
|
||||
|
||||
### Bash
|
||||
|
||||
@ -244,3 +240,11 @@ Invoke-Expression -Command path/to/task.ps1
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://golang.org/
|
||||
[snapcraft]: https://snapcraft.io/task
|
||||
[homebrew]: https://brew.sh/
|
||||
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[godownloader]: https://github.com/goreleaser/godownloader
|
||||
[choco]: https://chocolatey.org/
|
||||
[scoop]: https://scoop.sh/
|
||||
|
@ -10,11 +10,11 @@ title: Página Inicial
|
||||
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
|
||||
</div>
|
||||
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, [GNU Make](https://www.gnu.org/software/make/).
|
||||
Task é uma ferramenta de automatização de tarefas que foi criada para ser mais simples de usar do que outras similares, como por exemplo o [GNU Make][make].
|
||||
|
||||
Por ser escrito em [Go](https://go.dev/), o Task é simplesmente um binário e não possui nenhuma outra dependência, o que significa que você não precisa lidar com um processo de instalação complicado apenas para usar uma ferramenta de automação.
|
||||
Por ser escrito em [Go][go], o Task é simplesmente um binário e não possui nenhuma outra dependência, o que significa que você não precisa lidar com um processo de instalação complicado apenas para usar uma ferramenta de automação.
|
||||
|
||||
Uma vez [instalado](installation.md), você só precisa só precisa escrever suas tarefas usando um esquema [YAML](http://yaml.org/) simples num arquivo chamado `Taskfile.yml`:
|
||||
Uma vez [instalado](installation.md), você só precisa só precisa escrever suas tarefas usando um esquema [YAML][yaml] simples num arquivo chamado `Taskfile.yml`:
|
||||
|
||||
```yaml title="Taskfile.yml"
|
||||
version: '3'
|
||||
@ -32,10 +32,10 @@ O exemplo acima é apenas o começo. Você pode dar uma olhada no [guia de uso](
|
||||
|
||||
## Funcionalidades
|
||||
|
||||
- [Instalação fácil](installation.md): apenas baixe um único binário, adicione-o a `$PATH` e pronto! Ou você também pode instalá-lo usando [Homebrew](https://brew.sh/), [Snapcraft](https://snapcraft.io/) ou [Scoop](https://scoop.sh/) se você quiser.
|
||||
- Available on CIs: by adding [this simple command](installation.md#install-script) to install on your CI script and you're ready to use Task as part of your CI pipeline;
|
||||
- Verdadeiramente multiplataforma: enquanto a maioria das ferramentas de compilação só funcionam bem no Linux ou macOS, o Task também suporta Windows graças [a este interpretador de shell para Go](https://github.com/mvdan/sh).
|
||||
- Great for code generation: you can easily [prevent a task from running](/usage#prevent-unnecessary-work) if a given set of files haven't changed since last run (based either on its timestamp or content).
|
||||
- [Instalação fácil](installation.md): apenas baixe um único binário, adicione-o a `$PATH` e pronto! Ou você também pode instalá-lo usando [Homebrew][homebrew], [Snapcraft][snapcraft] ou [Scoop][scoop] se você quiser.
|
||||
- Disponível em CIs: adicionando [este script simples](installation.md#install-script) para instalá-lo no seu CI você estará pronto para usar o Task como parte do seu pipeline de CI;
|
||||
- Verdadeiramente multiplataforma: enquanto a maioria das ferramentas de compilação só funcionam bem no Linux ou macOS, o Task também suporta Windows graças [a este interpretador de shell para Go][sh].
|
||||
- Ótimo para a geração de código: você pode facilmente [impedir que uma tarefa execute](/usage#prevent-unnecessary-work) se um determinado conjunto de arquivos não tiver mudado desde a última execução (baseado na data de modificação ou conteúdo dos arquivos).
|
||||
|
||||
## Patrocinadores de Ouro
|
||||
|
||||
@ -50,3 +50,10 @@ O exemplo acima é apenas o começo. Você pode dar uma olhada no [guia de uso](
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[go]: https://go.dev/
|
||||
[yaml]: http://yaml.org/
|
||||
[homebrew]: https://brew.sh/
|
||||
[snapcraft]: https://snapcraft.io/
|
||||
[scoop]: https://scoop.sh/
|
||||
[sh]: https://github.com/mvdan/sh
|
||||
|
@ -5,26 +5,26 @@ sidebar_position: 10
|
||||
|
||||
# Releasing
|
||||
|
||||
The release process of Task is done with the help of [GoReleaser](https://goreleaser.com/). You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
The release process of Task is done with the help of [GoReleaser][goreleaser]. You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release artifacts automatically when a new Git tag is pushed to master (raw executables and DEB and RPM packages).
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release artifacts automatically when a new Git tag is pushed to `main` branch (raw executables and DEB and RPM packages).
|
||||
|
||||
Since v3.15.0, raw executables can also be reproduced and verified locally by checking out a specific tag and calling `goreleaser build`, using the Go version defined in the above GitHub Actions.
|
||||
|
||||
# Homebrew
|
||||
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb](https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb) file in the [Homebrew tap](https://github.com/go-task/homebrew-tap) repository to release the new version.
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap] repository to release the new version.
|
||||
|
||||
# npm
|
||||
|
||||
To release to npm update the version in the [`package.json`](https://github.com/go-task/task/blob/master/package.json#L3) file and then run `task npm:publish` to push it.
|
||||
To release to npm update the version in the [`package.json`][packagejson] file and then run `task npm:publish` to push it.
|
||||
|
||||
# Snapcraft
|
||||
|
||||
The [snap package](https://github.com/go-task/snap) requires to manual steps to release a new version:
|
||||
The [snap package][snappackage] requires to manual steps to release a new version:
|
||||
|
||||
- Updating the current version on [snapcraft.yaml](https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2).
|
||||
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard](https://snapcraft.io/task/releases).
|
||||
- Updating the current version on [snapcraft.yaml][snapcraftyaml].
|
||||
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard][snapcraftdashboard].
|
||||
|
||||
# Scoop
|
||||
|
||||
@ -37,3 +37,10 @@ Nix is a community owned installation method. Nix package maintainers usually ta
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[goreleaser]: https://goreleaser.com/
|
||||
[homebrewtap]: https://github.com/go-task/homebrew-tap
|
||||
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
||||
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
|
||||
[snappackage]: https://github.com/go-task/snap
|
||||
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
||||
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||
|
@ -89,7 +89,7 @@ tasks:
|
||||
|
||||
## Version 2.1
|
||||
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation](usage.md#output-syntax) for more info):
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation][output] for more info):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -103,7 +103,7 @@ tasks:
|
||||
prefix: server
|
||||
```
|
||||
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here](usage.md#ignore-errors)):
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here][ignore_errors]):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -149,7 +149,7 @@ tasks:
|
||||
- aws s3 cp .env s3://myenvironment
|
||||
```
|
||||
|
||||
Please check the [documentation](usage.md#including-other-taskfiles)
|
||||
Please check the [documentation][includes]
|
||||
|
||||
## Version 3
|
||||
|
||||
@ -202,3 +202,7 @@ tasks:
|
||||
- Global + CLI variables
|
||||
- Call variables
|
||||
- Task variables
|
||||
|
||||
[output]: usage.md#output-syntax
|
||||
[ignore_errors]: usage.md#ignore-errors
|
||||
[includes]: usage.md#including-other-taskfiles
|
||||
|
@ -7,10 +7,12 @@ sidebar_position: 13
|
||||
|
||||
Quer nos ajudar a traduzir esta documentação? Neste documento, explicamos como.
|
||||
|
||||
NÃO edite os arquivos markdown traduzidos diretamente no repositório do GitHub! We use [Crowdin](https://crowdin.com/project/taskfile) to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
NÃO edite os arquivos markdown traduzidos diretamente no repositório do GitHub! We use [Crowdin][crowdin] to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server](https://discord.gg/6TY36E39UK). If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server][discord]. If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[crowdin]: https://crowdin.com/project/taskfile
|
||||
[discord]: https://discord.gg/6TY36E39UK
|
||||
|
@ -3,9 +3,9 @@ slug: /usage/
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Usage
|
||||
# Guia de Uso
|
||||
|
||||
## Getting started
|
||||
## Primeiros passos
|
||||
|
||||
Create a file called `Taskfile.yml` in the root of your project. The `cmds` attribute should contain the commands of a task. The example below allows compiling a Go app and uses [esbuild](https://esbuild.github.io/) to concat and minify multiple CSS files into a single one.
|
||||
|
||||
@ -71,7 +71,6 @@ This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
When running your global Taskfile with `-g`, tasks will run on `$HOME` by default, and not on your working directory!
|
||||
|
||||
As mentioned in the previous section, the `{{.USER_WORKING_DIR}}` special variable can be very handy here to run stuff on the directory you're calling `task -g` from.
|
||||
@ -92,7 +91,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Environment variables
|
||||
|
||||
### Task
|
||||
@ -126,12 +124,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
`env` supports expansion and retrieving output from a shell command just like variables, as you can see in the [Variables](#variables) section.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### .env files
|
||||
|
||||
You can also ask Task to include `.env` like files by using the `dotenv:` setting:
|
||||
@ -192,12 +188,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Please note that you are not currently able to use the `dotenv` key inside included Taskfiles.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Including other Taskfiles
|
||||
|
||||
If you want to share tasks between different projects (Taskfiles), you can use the importing mechanism to include other Taskfiles using the `includes` keyword:
|
||||
@ -240,12 +234,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
The included Taskfiles must be using the same schema version as the main Taskfile uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Optional includes
|
||||
|
||||
Includes marked as optional will allow Task to continue execution as normal if the included file is missing.
|
||||
@ -312,12 +304,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Vars declared in the included Taskfile have preference over the variables in the including Taskfile! If you want a variable in an included Taskfile to be overridable, use the [default function](https://go-task.github.io/slim-sprig/defaults.html): `MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Internal tasks
|
||||
|
||||
Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running `task --list|--list-all`. Other tasks may call internal tasks in the usual way. This is useful for creating reusable, function-like tasks that have no useful purpose on the command line.
|
||||
@ -399,12 +389,10 @@ If there is more than one dependency, they always run in parallel for better per
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
You can also make the tasks given by the command line run in parallel by using the `--parallel` flag (alias `-p`). Example: `task --parallel js css`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
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):
|
||||
|
||||
```yaml
|
||||
@ -537,12 +525,10 @@ The above syntax is also supported in `deps`.
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
NOTE: If you want to call a task declared in the root Taskfile from within an [included Taskfile](#including-other-taskfiles), add a leading `:` like this: `task: :task-name`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Prevent unnecessary work
|
||||
|
||||
### By fingerprinting locally generated files and their sources
|
||||
@ -597,7 +583,6 @@ In situations where you need more flexibility the `status` keyword can be used.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
By default, task stores checksums on a local `.task` directory in the project's directory. Most of the time, you'll want to have this directory on `.gitignore` (or equivalent) so it isn't committed. (If you have a task for code generation that is committed it may make sense to commit the checksum of that task as well, though).
|
||||
|
||||
If you want these files to be stored in another directory, you can set a `TASK_TEMP_DIR` environment variable in your machine. It can contain a relative path like `tmp/task` that will be interpreted as relative to the project directory, or an absolute or home path like `/tmp/.task` or `~/.task` (subdirectories will be created for each project).
|
||||
@ -608,33 +593,26 @@ export TASK_TEMP_DIR='~/.task'
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Each task has only one checksum stored for its `sources`. If you want to distinguish a task by any of its input variables, you can add those variables as part of the task's label, and it will be considered a different task.
|
||||
|
||||
This is useful if you want to run a task once for each distinct set of inputs until the sources actually change. For example, if the sources depend on the value of a variable, or you if you want the task to rerun if some arguments change even if the source has not.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The method `none` skips any validation and always run the task.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
For the `checksum` (default) or `timestamp` method to work, it is only necessary to inform the source files. When the `timestamp` method is used, the last time of the running the task is considered as a generate.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Using programmatic checks to indicate a task is up to date
|
||||
|
||||
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:
|
||||
@ -788,12 +766,10 @@ $ TASK_VARIABLE=a-value task do-something
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
A special variable `.TASK` is always available containing the task name.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
Since some shells do not support the above syntax to set environment variables (Windows) tasks also accept a similar style when not at the beginning of the command.
|
||||
|
||||
```bash
|
||||
@ -898,15 +874,13 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Due to the nature of how the [Go's own `defer` work](https://go.dev/tour/flowcontrol/13), the deferred commands are executed in the reverse order if you schedule multiple of them.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Go's template engine
|
||||
|
||||
Task parse commands as [Go's template engine](https://golang.org/pkg/text/template/) before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
Task parse commands as [Go's template engine][gotemplate] before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
|
||||
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:
|
||||
|
||||
@ -1291,12 +1265,10 @@ $ task default
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The `output` option can also be specified by the `--output` or `-o` flags.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Interactive CLI application
|
||||
|
||||
When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the [output mode](#output-syntax) is set to something other than `interleaved` (the default), or when interactive apps are run in parallel with other tasks.
|
||||
@ -1347,12 +1319,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Keep in mind that not all options are available in the [shell interpreter library](https://github.com/mvdan/sh) that Task uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Watch tasks
|
||||
|
||||
With the flags `--watch` or `-w` task will watch for file changes and run the task again. This requires the `sources` attribute to be given, so task knows which files to watch.
|
||||
@ -1362,3 +1332,4 @@ The default watch interval is 5 seconds, but it's possible to change it by eithe
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
|
@ -17,12 +17,10 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If `--` is given, all remaning arguments will be assigned to a special `CLI_ARGS` variable
|
||||
|
||||
:::
|
||||
|
||||
|
||||
| Short | Flag | Type | Default | Description |
|
||||
| ----- | --------------------------- | -------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | Colored output. Enabled by default. Set flag to `false` or use `NO_COLOR=1` to disable. |
|
||||
@ -52,6 +50,35 @@ If `--` is given, all remaning arguments will be assigned to a special `CLI_ARGS
|
||||
| | `--version` | `bool` | `false` | Show Task version. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Enables watch of the given task. |
|
||||
|
||||
## Exit Codes
|
||||
|
||||
Task will sometimes exit with specific exit codes. These codes are split into three groups with the following ranges:
|
||||
|
||||
- General errors (0-99)
|
||||
- Taskfile errors (100-199)
|
||||
- Task errors (200-299)
|
||||
|
||||
A full list of the exit codes and their descriptions can be found below:
|
||||
|
||||
| Code | Description |
|
||||
| ---- | ------------------------------------------------------------ |
|
||||
| 0 | Success |
|
||||
| 1 | An unknown error occurred |
|
||||
| 100 | No Taskfile was found |
|
||||
| 101 | A Taskfile already exists when trying to initialize one |
|
||||
| 102 | The Taskfile is invalid or cannot be parsed |
|
||||
| 200 | The specified task could not be found |
|
||||
| 201 | An error occurred while executing a command inside of a task |
|
||||
| 202 | The user tried to invoke a task that is internal |
|
||||
| 203 | There a multiple tasks with the same name or alias |
|
||||
| 204 | A task was called too many times |
|
||||
|
||||
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
|
||||
|
||||
:::info
|
||||
When Task is run with the `-x`/`--exit-code` flag, the exit code of any failed commands will be passed through to the user instead.
|
||||
:::
|
||||
|
||||
## JSON Output
|
||||
|
||||
When using the `--json` flag in combination with either the `--list` or `--list-all` flags, the output will be a JSON object with the following structure:
|
||||
@ -138,7 +165,6 @@ Some environment variables can be overriden to adjust Task behavior.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Informing only a string like below is equivalent to setting that value to the `taskfile` attribute.
|
||||
|
||||
```yaml
|
||||
@ -148,7 +174,6 @@ includes:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Variable
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -158,7 +183,6 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Static and dynamic variables have different syntaxes, like below:
|
||||
|
||||
```yaml
|
||||
@ -170,7 +194,6 @@ vars:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Task
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -196,13 +219,12 @@ vars:
|
||||
| `prefix` | `string` | | Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing commands. |
|
||||
| `run` | `string` | The one declared globally in the Taskfile or `always` | Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the task should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/go/build/syslist.go). Task will be skipped otherwise. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the task should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/main/src/go/build/syslist.go). Task will be skipped otherwise. |
|
||||
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
These alternative syntaxes are available. They will set the given values to `cmds` and everything else will be set to their default values:
|
||||
|
||||
```yaml
|
||||
@ -219,24 +241,22 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Command
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| -------------- | ---------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -------------- | ---------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cmd` | `string` | | The shell command to be executed. |
|
||||
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
|
||||
| `task` | `string` | | Set this to trigger execution of another task instead of running a command. This cannot be set together with `cmd`. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the referenced task. Only relevant when setting `task` instead of `cmd`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing the command. |
|
||||
| `defer` | `string` | | Alternative to `cmd`, but schedules the command to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/go/build/syslist.go). Command will be skipped otherwise. |
|
||||
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/main/src/go/build/syslist.go). Command will be skipped otherwise. |
|
||||
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
If given as a a string, the value will be assigned to `cmd`:
|
||||
|
||||
```yaml
|
||||
@ -249,7 +269,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Dependency
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -259,7 +278,6 @@ tasks:
|
||||
|
||||
:::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
|
||||
@ -270,7 +288,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Precondition
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@ -280,7 +297,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If you don't want to set a different message, you can declare a precondition like this and the value will be assigned to `sh`:
|
||||
|
||||
```yaml
|
||||
|
@ -5,6 +5,17 @@ sidebar_position: 7
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.24.0 - 2023-04-15
|
||||
|
||||
- Fix Fish shell completion for tasks with aliases ([#1113](https://github.com/go-task/task/issues/1113) by [@patricksjackson](https://github.com/patricksjackson)).
|
||||
- The default branch was renamed from `master` to `main` ([#1049](https://github.com/go-task/task/issues/1049), [#1048](https://github.com/go-task/task/issues/1048) by [@pd93](https://github.com/pd93)).
|
||||
- Fix bug where "up-to-date" logs were not being omitted for silent tasks ([#546](https://github.com/go-task/task/issues/546), [#1107](https://github.com/go-task/task/issues/1107) by [@danquah](https://github.com/danquah)).
|
||||
- Add `.hg` (Mercurial) to the list of ignored directories when using `--watch` ([#1098](https://github.com/go-task/task/issues/1098) by [@misery](https://github.com/misery)).
|
||||
- More improvements to the release tool ([#1096](https://github.com/go-task/task/issues/1096) by [@pd93](https://github.com/pd93)).
|
||||
- Enforce [gofumpt](https://github.com/mvdan/gofumpt) linter ([#1099](https://github.com/go-task/task/issues/1099) by [@pd93](https://github.com/pd93))
|
||||
- Add `--sort` flag for use with `--list` and `--list-all` ([#946](https://github.com/go-task/task/issues/946), [#1105](https://github.com/go-task/task/issues/1105) by [@pd93](https://github.com/pd93)).
|
||||
- Task now has [custom exit codes](https://taskfile.dev/api/#exit-codes) depending on the error ([#1114](https://github.com/go-task/task/issues/1114) by [@pd93](https://github.com/pd93)).
|
||||
|
||||
## v3.23.0 - 2023-03-26
|
||||
|
||||
Task now has an [official extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=task.vscode-task) contributed by [@pd93](https://github.com/pd93)! :tada: The extension is maintained in a [new repository](https://github.com/go-task/vscode-task) under the `go-task` organization. We're looking to gather feedback from the community so please give it a go and let us know what you think via a [discussion](https://github.com/go-task/vscode-task/discussions), [issue](https://github.com/go-task/vscode-task/issues) or on our [Discord](https://discord.gg/6TY36E39UK)!
|
||||
@ -14,8 +25,7 @@ Task now has an [official extension for Visual Studio Code](https://marketplace.
|
||||
- The website was integrated with [Crowdin](https://crowdin.com/project/taskfile) to allow the community to contribute with translations! [Chinese](https://taskfile.dev/zh-Hans/) is the first language available ([#1057](https://github.com/go-task/task/issues/1057), [#1058](https://github.com/go-task/task/issues/1058) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added task location data to the `--json` flag output ([#1056](https://github.com/go-task/task/issues/1056) by [@pd93](https://github.com/pd93))
|
||||
- Change the name of the file generated by `task --init` from `Taskfile.yaml` to `Taskfile.yml` ([#1062](https://github.com/go-task/task/issues/1062) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar
|
||||
baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Fix the value of `{{.CHECKSUM}}` variable in status ([#1076](https://github.com/go-task/task/issues/1076), [#1080](https://github.com/go-task/task/issues/1080) by [@pd93](https://github.com/pd93)).
|
||||
- Fixed deep copy implementation ([#1072](https://github.com/go-task/task/issues/1072) by [@pd93](https://github.com/pd93))
|
||||
- Created a tool to assist with releases ([#1086](https://github.com/go-task/task/issues/1086) by [@pd93](https://github.com/pd93)).
|
||||
@ -40,8 +50,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
- Improve behavior and performance of status checking when using the `timestamp` mode ([#976](https://github.com/go-task/task/issues/976), [#977](https://github.com/go-task/task/issues/977) by [@aminya](https://github.com/aminya)).
|
||||
- Performance optimizations were made for large Taskfiles ([#982](https://github.com/go-task/task/issues/982) by [@pd93](https://github.com/pd93)).
|
||||
- Add ability to configure options for the [`set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) and [`shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) builtins ([#908](https://github.com/go-task/task/issues/908), [#929](https://github.com/go-task/task/issues/929) by [@pd93](https://github.com/pd93), [Documentation](http://taskfile.dev/usage/#set-and-shopt)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms:
|
||||
[linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms: [linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
|
||||
## v3.19.1 - 2022-12-31
|
||||
|
||||
@ -151,8 +160,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
|
||||
## v3.9.0 - 2021-10-02
|
||||
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a
|
||||
string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with some small fixes and features
|
||||
- The `read -p` flag is now supported ([#314](https://github.com/go-task/task/issues/314), [mvdan/sh\[#551\](https://github.com/go-task/task/issues/551)](https://github.com/mvdan/sh/issues/551), [mvdan/sh\[#772\](https://github.com/go-task/task/issues/772)](https://github.com/mvdan/sh/pull/722))
|
||||
- The `pwd -P` and `pwd -L` flags are now supported ([#553](https://github.com/go-task/task/issues/553), [mvdan/sh\[#724\](https://github.com/go-task/task/issues/724)](https://github.com/mvdan/sh/issues/724), [mvdan/sh\[#728\](https://github.com/go-task/task/issues/728)](https://github.com/mvdan/sh/pull/728))
|
||||
@ -327,7 +335,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
- Added support for [including other Taskfiles](https://taskfile.org/#/usage?id=including-other-taskfiles) ([#98](https://github.com/go-task/task/issues/98))
|
||||
- This should be considered experimental. For now, only including local files is supported, but support for including remote Taskfiles is being discussed. If you have any feedback, please comment on [#98](https://github.com/go-task/task/issues/98).
|
||||
- Task now have a dedicated documentation site: https://taskfile.org
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/master/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/main/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
|
||||
## v2.1.1 - 2018-09-17
|
||||
|
||||
@ -359,7 +367,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
|
||||
Version 2.0.0 is here, with a new Taskfile format.
|
||||
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/master/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/main/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
|
||||
- New Taskfile version 2 ([#77](https://github.com/go-task/task/issues/77))
|
||||
- Possibility to have global variables in the `Taskfile.yml` instead of `Taskvars.yml` ([#66](https://github.com/go-task/task/issues/66))
|
||||
|
@ -15,7 +15,7 @@ Some of the work to improve the Task ecosystem is done by the community, be it i
|
||||
|
||||
### JSON Schema
|
||||
|
||||
Initial work on the schema was made by [@KROSF](https://github.com/KROSF) on [this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895). The schema is currently available at https://taskfile.dev/schema.json and linked at https://json.schemastore.org/taskfile.json so it is be used automatically many code editors, like VSCode. Contributions can be done by editing [this file](https://github.com/go-task/task/blob/master/docs/static/schema.json).
|
||||
Initial work on the schema was made by [@KROSF](https://github.com/KROSF) on [this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895). The schema is currently available at https://taskfile.dev/schema.json and linked at https://json.schemastore.org/taskfile.json so it is be used automatically many code editors, like VSCode. Contributions can be done by editing [this file](https://github.com/go-task/task/blob/main/docs/static/schema.json).
|
||||
|
||||
### Visual Studio Code extension
|
||||
|
||||
|
@ -14,9 +14,9 @@ Contributions to Task are very welcome, but we ask that you read this document b
|
||||
|
||||
## 1. Setup
|
||||
|
||||
- **Go** - Task is written in [Go](https://go.dev). We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js](https://nodejs.org/en/) is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn](https://yarnpkg.com/) is the Node.js package manager used by Task.
|
||||
- **Go** - Task is written in [Go][go]. We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js][nodejs] is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn][yarn] is the Node.js package manager used by Task.
|
||||
|
||||
## 2. Making changes
|
||||
|
||||
@ -30,11 +30,11 @@ To run Task with working changes, you can use `go run ./cmd/task`. To run a deve
|
||||
|
||||
### Updating documentation
|
||||
|
||||
Task uses [Docusaurus](https://docusaurus.io) to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
Task uses [Docusaurus][docusaurus] to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
|
||||
When making a change, consider whether a change to the [Usage Guide](./usage.md) is necessary. This document contains descriptions and examples of how to use Task features. If you're adding a new feature, try to find an appropriate place to add a new section. If you're updating an existing feature, ensure that the documentation and any examples are up-to-date. Ensure that any examples follow the [Taskfile Styleguide](./styleguide.md).
|
||||
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema](https://github.com/go-task/task/blob/master/docs/static/schema.json). The descriptions for fields in the API reference and the schema should match.
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema][json-schema]. The descriptions for fields in the API reference and the schema should match.
|
||||
|
||||
### Writing tests
|
||||
|
||||
@ -57,16 +57,25 @@ Try to write meaningful commit messages and avoid having too many commits on the
|
||||
|
||||
> I want to contribute, where do I start?
|
||||
|
||||
Take a look at the list of [open issues](https://github.com/go-task/task/issues). We have a [good first issue](https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label for simpler issues that are ideal for first time contributions.
|
||||
Take a look at the list of [open issues][open-issues]. We have a [good first issue][good-first-issue] label for simpler issues that are ideal for first time contributions.
|
||||
|
||||
All kinds of contributions are welcome, whether its a typo fix or a shiny new feature. You can also contribute by upvoting/commenting on issues, helping to answer questions or contributing to other [community projects](./community.md).
|
||||
|
||||
> I'm stuck, where can I get help?
|
||||
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server](https://discord.gg/6TY36E39UK) or open a [Discussion](https://github.com/go-task/task/discussions) on GitHub.
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server][discord-server] or open a [Discussion][discussion] on GitHub.
|
||||
|
||||
---
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://go.dev
|
||||
[nodejs]: https://nodejs.org/en/
|
||||
[yarn]: https://yarnpkg.com/
|
||||
[docusaurus]: https://docusaurus.io
|
||||
[json-schema]: https://github.com/go-task/task/blob/main/docs/static/schema.json
|
||||
[open-issues]: https://github.com/go-task/task/issues
|
||||
[good-first-issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
[discord-server]: https://discord.gg/6TY36E39UK
|
||||
[discussion]: https://github.com/go-task/task/discussions
|
||||
|
@ -9,7 +9,7 @@ If you find this project useful, you can consider donating by using one of the c
|
||||
|
||||
This is just a way of saying "thank you", it won't give you any benefits like higher priority on issues or something similar.
|
||||
|
||||
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in the website homepage and on the GitHub repository README. Make contact with [@andreynering](https://github.com/andreynering) with the logo you want to be shown. Suspect businesses (gambling, casinos, etc) won't be allowed, though.
|
||||
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in the website homepage and on the GitHub repository README. Make contact with [@andreynering][] with the logo you want to be shown. Suspect businesses (gambling, casinos, etc) won't be allowed, though.
|
||||
|
||||
## GitHub Sponsors
|
||||
|
||||
@ -30,14 +30,15 @@ If you prefer [Open Collective](https://opencollective.com/task) you can donate
|
||||
|
||||
## PayPal
|
||||
|
||||
You can donate to [@andreynering](https://github.com/andreynering) via PayPal as well:
|
||||
You can donate to [@andreynering][] via PayPal as well:
|
||||
|
||||
- [Any value - One-time donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url)
|
||||
|
||||
## PIX (Brazil only)
|
||||
|
||||
And if you're Brazilian, you can also donate to [@andreynering](https://github.com/andreynering) via PIX by [using this QR Code](/img/pix.png).
|
||||
And if you're Brazilian, you can also donate to [@andreynering][] via PIX by [using this QR Code](/img/pix.png).
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[@andreynering]: https://github.com/andreynering
|
||||
|
@ -31,7 +31,7 @@ The default shell on Windows (`cmd` and `powershell`) do not have commands like
|
||||
|
||||
- Use the `{{OS}}` function to run an OS-specific script.
|
||||
- Use something like `{{if eq OS "windows"}}powershell {{end}}<my_cmd>` to detect windows and run the command in Powershell directly.
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash](https://gitforwindows.org/) or [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash][git-bash] or [WSL][wsl].
|
||||
|
||||
We want to make improvements to this part of Task and the issues below track this work. Constructive comments and contributions are very welcome!
|
||||
|
||||
@ -42,3 +42,5 @@ We want to make improvements to this part of Task and the issues below track thi
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[git-bash]: https://gitforwindows.org/
|
||||
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
|
||||
|
@ -11,7 +11,7 @@ Task offers many installation methods. Check out the available methods below.
|
||||
|
||||
### Homebrew
|
||||
|
||||
If you're on macOS or Linux and have [Homebrew](https://brew.sh/) installed, getting Task is as simple as running:
|
||||
If you're on macOS or Linux and have [Homebrew][homebrew] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
brew install go-task/tap/go-task
|
||||
@ -27,7 +27,7 @@ brew install go-task
|
||||
|
||||
### Snap
|
||||
|
||||
Task is available in [Snapcraft](https://snapcraft.io/task), but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
Task is available in [Snapcraft][snapcraft], but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
|
||||
```bash
|
||||
sudo snap install task --classic
|
||||
@ -35,7 +35,7 @@ sudo snap install task --classic
|
||||
|
||||
### Chocolatey
|
||||
|
||||
If you're on Windows and have [Chocolatey](https://chocolatey.org/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Chocolatey][choco] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
choco install go-task
|
||||
@ -45,7 +45,7 @@ This installation method is community owned.
|
||||
|
||||
### Scoop
|
||||
|
||||
If you're on Windows and have [Scoop](https://scoop.sh/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Scoop][scoop] installed, getting Task is as simple as running:
|
||||
|
||||
```cmd
|
||||
scoop install task
|
||||
@ -109,7 +109,7 @@ winget install Task.Task
|
||||
|
||||
### Binary
|
||||
|
||||
You can download the binary from the [releases page on GitHub](https://github.com/go-task/task/releases) and add to your `$PATH`.
|
||||
You can download the binary from the [releases page on GitHub][releases] and add to your `$PATH`.
|
||||
|
||||
DEB and RPM packages are also available.
|
||||
|
||||
@ -117,7 +117,7 @@ The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
||||
|
||||
### Install Script
|
||||
|
||||
We also have an [install script](https://github.com/go-task/task/blob/master/install-task.sh) which is very useful in scenarios like CI. Many thanks to [GoDownloader](https://github.com/goreleaser/godownloader) for enabling the easy generation of this script.
|
||||
We also have an [install script][installscript] which is very useful in scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the easy generation of this script.
|
||||
|
||||
By default, it installs on the `./bin` directory relative to the working directory:
|
||||
|
||||
@ -133,12 +133,10 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
|
||||
:::caution
|
||||
|
||||
|
||||
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by default.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
If you want to install Task in GitHub Actions you can try using [this action](https://github.com/arduino/setup-task) by the Arduino team:
|
||||
@ -157,7 +155,7 @@ This installation method is community owned.
|
||||
|
||||
### Go Modules
|
||||
|
||||
Ensure that you have a supported version of [Go](https://golang.org/) properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/master/go.mod#L3) file.
|
||||
Ensure that you have a supported version of [Go][go] properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
|
||||
|
||||
You can then install the latest release globally by running:
|
||||
|
||||
@ -173,17 +171,15 @@ env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
For CI environments we recommend using the [install script](#install-script) instead, which is faster and more stable, since it'll just download the latest released binary.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Setup completions
|
||||
|
||||
Download the autocompletion file corresponding to your shell.
|
||||
|
||||
[All completions are available on the Task repository](https://github.com/go-task/task/tree/master/completion).
|
||||
[All completions are available on the Task repository](https://github.com/go-task/task/tree/main/completion).
|
||||
|
||||
### Bash
|
||||
|
||||
@ -244,3 +240,11 @@ Invoke-Expression -Command path/to/task.ps1
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://golang.org/
|
||||
[snapcraft]: https://snapcraft.io/task
|
||||
[homebrew]: https://brew.sh/
|
||||
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[godownloader]: https://github.com/goreleaser/godownloader
|
||||
[choco]: https://chocolatey.org/
|
||||
[scoop]: https://scoop.sh/
|
||||
|
@ -10,11 +10,11 @@ title: Home
|
||||
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
|
||||
</div>
|
||||
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, [GNU Make](https://www.gnu.org/software/make/).
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, [GNU Make][make].
|
||||
|
||||
Since it's written in [Go](https://go.dev/), Task is just a single binary and has no other dependencies, which means you don't need to mess with any complicated install setups just to use a build tool.
|
||||
Since it's written in [Go][go], Task is just a single binary and has no other dependencies, which means you don't need to mess with any complicated install setups just to use a build tool.
|
||||
|
||||
Once [installed](installation.md), you just need to describe your build tasks using a simple [YAML](http://yaml.org/) schema in a file called `Taskfile.yml`:
|
||||
Once [installed](installation.md), you just need to describe your build tasks using a simple [YAML][yaml] schema in a file called `Taskfile.yml`:
|
||||
|
||||
```yaml title="Taskfile.yml"
|
||||
version: '3'
|
||||
@ -32,9 +32,9 @@ The above example is just the start, you can take a look at the [usage](/usage)
|
||||
|
||||
## Features
|
||||
|
||||
- [Easy installation](installation.md): just download a single binary, add to `$PATH` and you're done! Or you can also install using [Homebrew](https://brew.sh/), [Snapcraft](https://snapcraft.io/), or [Scoop](https://scoop.sh/) if you want.
|
||||
- [Easy installation](installation.md): just download a single binary, add to `$PATH` and you're done! Or you can also install using [Homebrew][homebrew], [Snapcraft][snapcraft], or [Scoop][scoop] if you want.
|
||||
- Available on CIs: by adding [this simple command](installation.md#install-script) to install on your CI script and you're ready to use Task as part of your CI pipeline;
|
||||
- Truly cross-platform: while most build tools only work well on Linux or macOS, Task also supports Windows thanks to [this shell interpreter for Go](https://github.com/mvdan/sh).
|
||||
- Truly cross-platform: while most build tools only work well on Linux or macOS, Task also supports Windows thanks to [this shell interpreter for Go][sh].
|
||||
- Great for code generation: you can easily [prevent a task from running](/usage#prevent-unnecessary-work) if a given set of files haven't changed since last run (based either on its timestamp or content).
|
||||
|
||||
## Gold Sponsors
|
||||
@ -50,3 +50,10 @@ The above example is just the start, you can take a look at the [usage](/usage)
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[go]: https://go.dev/
|
||||
[yaml]: http://yaml.org/
|
||||
[homebrew]: https://brew.sh/
|
||||
[snapcraft]: https://snapcraft.io/
|
||||
[scoop]: https://scoop.sh/
|
||||
[sh]: https://github.com/mvdan/sh
|
||||
|
@ -5,26 +5,26 @@ sidebar_position: 10
|
||||
|
||||
# Releasing
|
||||
|
||||
The release process of Task is done with the help of [GoReleaser](https://goreleaser.com/). You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
The release process of Task is done with the help of [GoReleaser][goreleaser]. You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release artifacts automatically when a new Git tag is pushed to master (raw executables and DEB and RPM packages).
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release artifacts automatically when a new Git tag is pushed to `main` branch (raw executables and DEB and RPM packages).
|
||||
|
||||
Since v3.15.0, raw executables can also be reproduced and verified locally by checking out a specific tag and calling `goreleaser build`, using the Go version defined in the above GitHub Actions.
|
||||
|
||||
# Homebrew
|
||||
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb](https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb) file in the [Homebrew tap](https://github.com/go-task/homebrew-tap) repository to release the new version.
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap] repository to release the new version.
|
||||
|
||||
# npm
|
||||
|
||||
To release to npm update the version in the [`package.json`](https://github.com/go-task/task/blob/master/package.json#L3) file and then run `task npm:publish` to push it.
|
||||
To release to npm update the version in the [`package.json`][packagejson] file and then run `task npm:publish` to push it.
|
||||
|
||||
# Snapcraft
|
||||
|
||||
The [snap package](https://github.com/go-task/snap) requires to manual steps to release a new version:
|
||||
The [snap package][snappackage] requires to manual steps to release a new version:
|
||||
|
||||
- Updating the current version on [snapcraft.yaml](https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2).
|
||||
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard](https://snapcraft.io/task/releases).
|
||||
- Updating the current version on [snapcraft.yaml][snapcraftyaml].
|
||||
- Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard][snapcraftdashboard].
|
||||
|
||||
# Scoop
|
||||
|
||||
@ -37,3 +37,10 @@ Nix is a community owned installation method. Nix package maintainers usually ta
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[goreleaser]: https://goreleaser.com/
|
||||
[homebrewtap]: https://github.com/go-task/homebrew-tap
|
||||
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
||||
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
|
||||
[snappackage]: https://github.com/go-task/snap
|
||||
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
||||
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||
|
@ -89,7 +89,7 @@ tasks:
|
||||
|
||||
## Version 2.1
|
||||
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation](usage.md#output-syntax) for more info):
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation][output] for more info):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -103,7 +103,7 @@ tasks:
|
||||
prefix: server
|
||||
```
|
||||
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here](usage.md#ignore-errors)):
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here][ignore_errors]):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -149,7 +149,7 @@ tasks:
|
||||
- aws s3 cp .env s3://myenvironment
|
||||
```
|
||||
|
||||
Please check the [documentation](usage.md#including-other-taskfiles)
|
||||
Please check the [documentation][includes]
|
||||
|
||||
## Version 3
|
||||
|
||||
@ -202,3 +202,7 @@ tasks:
|
||||
- Global + CLI variables
|
||||
- Call variables
|
||||
- Task variables
|
||||
|
||||
[output]: usage.md#output-syntax
|
||||
[ignore_errors]: usage.md#ignore-errors
|
||||
[includes]: usage.md#including-other-taskfiles
|
||||
|
@ -7,10 +7,12 @@ sidebar_position: 13
|
||||
|
||||
Want to help us translate this documentation? In this document we explain how.
|
||||
|
||||
Do NOT edit translated markdown files directly on the GitHub repository! We use [Crowdin](https://crowdin.com/project/taskfile) to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
Do NOT edit translated markdown files directly on the GitHub repository! We use [Crowdin][crowdin] to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server](https://discord.gg/6TY36E39UK). If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server][discord]. If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[crowdin]: https://crowdin.com/project/taskfile
|
||||
[discord]: https://discord.gg/6TY36E39UK
|
||||
|
@ -71,7 +71,6 @@ This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
When running your global Taskfile with `-g`, tasks will run on `$HOME` by default, and not on your working directory!
|
||||
|
||||
As mentioned in the previous section, the `{{.USER_WORKING_DIR}}` special variable can be very handy here to run stuff on the directory you're calling `task -g` from.
|
||||
@ -92,7 +91,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Environment variables
|
||||
|
||||
### Task
|
||||
@ -126,12 +124,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
`env` supports expansion and retrieving output from a shell command just like variables, as you can see in the [Variables](#variables) section.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### .env files
|
||||
|
||||
You can also ask Task to include `.env` like files by using the `dotenv:` setting:
|
||||
@ -192,12 +188,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Please note that you are not currently able to use the `dotenv` key inside included Taskfiles.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Including other Taskfiles
|
||||
|
||||
If you want to share tasks between different projects (Taskfiles), you can use the importing mechanism to include other Taskfiles using the `includes` keyword:
|
||||
@ -240,12 +234,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
The included Taskfiles must be using the same schema version as the main Taskfile uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Optional includes
|
||||
|
||||
Includes marked as optional will allow Task to continue execution as normal if the included file is missing.
|
||||
@ -312,12 +304,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Vars declared in the included Taskfile have preference over the variables in the including Taskfile! If you want a variable in an included Taskfile to be overridable, use the [default function](https://go-task.github.io/slim-sprig/defaults.html): `MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Internal tasks
|
||||
|
||||
Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running `task --list|--list-all`. Other tasks may call internal tasks in the usual way. This is useful for creating reusable, function-like tasks that have no useful purpose on the command line.
|
||||
@ -399,12 +389,10 @@ If there is more than one dependency, they always run in parallel for better per
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
You can also make the tasks given by the command line run in parallel by using the `--parallel` flag (alias `-p`). Example: `task --parallel js css`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
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):
|
||||
|
||||
```yaml
|
||||
@ -537,12 +525,10 @@ The above syntax is also supported in `deps`.
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
NOTE: If you want to call a task declared in the root Taskfile from within an [included Taskfile](#including-other-taskfiles), add a leading `:` like this: `task: :task-name`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Prevent unnecessary work
|
||||
|
||||
### By fingerprinting locally generated files and their sources
|
||||
@ -597,7 +583,6 @@ In situations where you need more flexibility the `status` keyword can be used.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
By default, task stores checksums on a local `.task` directory in the project's directory. Most of the time, you'll want to have this directory on `.gitignore` (or equivalent) so it isn't committed. (If you have a task for code generation that is committed it may make sense to commit the checksum of that task as well, though).
|
||||
|
||||
If you want these files to be stored in another directory, you can set a `TASK_TEMP_DIR` environment variable in your machine. It can contain a relative path like `tmp/task` that will be interpreted as relative to the project directory, or an absolute or home path like `/tmp/.task` or `~/.task` (subdirectories will be created for each project).
|
||||
@ -608,33 +593,26 @@ export TASK_TEMP_DIR='~/.task'
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Each task has only one checksum stored for its `sources`. If you want to distinguish a task by any of its input variables, you can add those variables as part of the task's label, and it will be considered a different task.
|
||||
|
||||
This is useful if you want to run a task once for each distinct set of inputs until the sources actually change. For example, if the sources depend on the value of a variable, or you if you want the task to rerun if some arguments change even if the source has not.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The method `none` skips any validation and always run the task.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
For the `checksum` (default) or `timestamp` method to work, it is only necessary to inform the source files. When the `timestamp` method is used, the last time of the running the task is considered as a generate.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Using programmatic checks to indicate a task is up to date
|
||||
|
||||
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:
|
||||
@ -788,12 +766,10 @@ $ TASK_VARIABLE=a-value task do-something
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
A special variable `.TASK` is always available containing the task name.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
Since some shells do not support the above syntax to set environment variables (Windows) tasks also accept a similar style when not at the beginning of the command.
|
||||
|
||||
```bash
|
||||
@ -898,15 +874,13 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Due to the nature of how the [Go's own `defer` work](https://go.dev/tour/flowcontrol/13), the deferred commands are executed in the reverse order if you schedule multiple of them.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Go's template engine
|
||||
|
||||
Task parse commands as [Go's template engine](https://golang.org/pkg/text/template/) before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
Task parse commands as [Go's template engine][gotemplate] before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
|
||||
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:
|
||||
|
||||
@ -1291,12 +1265,10 @@ $ task default
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The `output` option can also be specified by the `--output` or `-o` flags.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Interactive CLI application
|
||||
|
||||
When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the [output mode](#output-syntax) is set to something other than `interleaved` (the default), or when interactive apps are run in parallel with other tasks.
|
||||
@ -1347,12 +1319,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Keep in mind that not all options are available in the [shell interpreter library](https://github.com/mvdan/sh) that Task uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Watch tasks
|
||||
|
||||
With the flags `--watch` or `-w` task will watch for file changes and run the task again. This requires the `sources` attribute to be given, so task knows which files to watch.
|
||||
@ -1362,3 +1332,4 @@ The default watch interval is 5 seconds, but it's possible to change it by eithe
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
|
@ -17,12 +17,10 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
如果 `--` 给出,所有剩余参数将被分配给一个特殊的 `CLI_ARGS` 变量
|
||||
|
||||
:::
|
||||
|
||||
|
||||
| 缩写 | 标志 | 类型 | 默认 | 描述 |
|
||||
| ---- | --------------------------- | -------- | -------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | 彩色输出。 默认开启。 设置为 `false` 或使用 `NO_COLOR=1` 禁用。 |
|
||||
@ -52,6 +50,35 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
| | `--version` | `bool` | `false` | 显示 Task 版本。 |
|
||||
| `-w` | `--watch` | `bool` | `false` | 启用给定任务的观察器。 |
|
||||
|
||||
## 退出码
|
||||
|
||||
Task 有时会以特定的退出代码退出。 这些代码分为三组,范围如下:
|
||||
|
||||
- 一般错误 (0-99)
|
||||
- Taskfile 错误 (100-199)
|
||||
- Task 错误 (200-299)
|
||||
|
||||
可以在下面找到退出代码及其描述的完整列表:
|
||||
|
||||
| 代码 | 描述 |
|
||||
| --- | ---------------------- |
|
||||
| 0 | 成功 |
|
||||
| 1 | 出现未知错误 |
|
||||
| 100 | 找不到 Taskfile |
|
||||
| 101 | 尝试初始化一个 Taskfile 时已经存在 |
|
||||
| 102 | Taskfile 无效或无法解析 |
|
||||
| 200 | 找不到指定的 task |
|
||||
| 201 | 在 task 中执行命令时出错 |
|
||||
| 202 | 用户试图调用内部 task |
|
||||
| 203 | 有多个具有相同名称或别名的 task |
|
||||
| 204 | 一个 task 被调用了太多次 |
|
||||
|
||||
这些代码也可以在存储库的 [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go) 中找到。
|
||||
|
||||
:::info
|
||||
当使用 `-x`/`--exit-code` 标志运行 Task 时,任何失败命令的退出代码都将传递给用户。
|
||||
:::
|
||||
|
||||
## JSON 输出
|
||||
|
||||
将 `--json` 标志与 `--list` 或 `--list-all` 标志结合使用时,将输出具有以下结构的 JSON 对象:
|
||||
@ -138,7 +165,6 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
像下面这样只赋值一个字符串,和把这个值设置到 `taskfile` 属性是一样的。
|
||||
|
||||
```yaml
|
||||
@ -148,7 +174,6 @@ includes:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Variable
|
||||
|
||||
| 属性 | 类型 | 默认 | 描述 |
|
||||
@ -158,7 +183,6 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
静态和动态变量有不同的语法,如下所示:
|
||||
|
||||
```yaml
|
||||
@ -170,7 +194,6 @@ vars:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Task
|
||||
|
||||
| 属性 | 类型 | 默认 | 描述 |
|
||||
@ -196,13 +219,12 @@ vars:
|
||||
| `prefix` | `string` | | 定义一个字符串作为并行运行 task 输出的前缀。 仅在输出模式是 `prefixed` 时使用。 |
|
||||
| `ignore_error` | `bool` | `false` | 如果执行命令时发生错误,则继续执行。 |
|
||||
| `run` | `string` | Taskfile 中全局声明的值或 `always` | 指定如果多次调用该任务是否应再次运行。 可用选项:`always`、`once` 和 `when_changed`。 |
|
||||
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行任务。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/master/src/go/build/syslist.go)。 否则将跳过任务。 |
|
||||
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行任务。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/main/src/go/build/syslist.go)。 否则将跳过任务。 |
|
||||
| `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
|
||||
|
||||
|
||||
这些替代语法可用。 他们会将给定值设置为 `cmds`,其他所有内容都将设置为其默认值:
|
||||
|
||||
```yaml
|
||||
@ -219,24 +241,22 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Command
|
||||
|
||||
| 属性 | 类型 | 默认 | 描述 |
|
||||
| -------------- | ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| -------------- | ---------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cmd` | `string` | | 要执行的 shell 命令 |
|
||||
| `silent` | `bool` | `false` | 跳过此命令的一些输出。 请注意,命令的 STDOUT 和 STDERR 仍将被重定向。 |
|
||||
| `task` | `string` | | 执行另一个 task,而不执行命令。 不能与 `cmd` 同时设置。 |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | 要传递给引用任务的可选附加变量。 仅在设置 `task` 而不是 `cmd` 时相关。 |
|
||||
| `ignore_error` | `bool` | `false` | 执行命令的时候忽略错误,继续执行 |
|
||||
| `defer` | `string` | | `cmd` 的替代方法,但安排命令在此任务结束时执行,而不是立即执行。 不能与 `cmd` 一同使用。 |
|
||||
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行该命令。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/master/src/go/build/syslist.go)。 否则将跳过命令。 |
|
||||
| `platforms` | `[]string` | 所有平台 | 指定应在哪些平台上运行该命令。 允许使用 [有效的 GOOS 和 GOARCH 值](https://github.com/golang/go/blob/main/src/go/build/syslist.go)。 否则将跳过命令。 |
|
||||
| `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
|
||||
|
||||
|
||||
如果以字符串形式给出,该值将分配给 `cmd`:
|
||||
|
||||
```yaml
|
||||
@ -249,7 +269,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Dependency
|
||||
|
||||
| 属性 | 类型 | 默认 | 描述 |
|
||||
@ -259,7 +278,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
如果你不想设置额外的变量,将依赖关系声明为一个字符串列表就足够了(它们将被分配给 `task`)。
|
||||
|
||||
```yaml
|
||||
@ -270,7 +288,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Precondition
|
||||
|
||||
| 属性 | 类型 | 默认 | 描述 |
|
||||
@ -280,7 +297,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
如果你不想设置不同的消息,你可以像这样声明一个前提条件,值将被分配给 `sh`:
|
||||
|
||||
```yaml
|
||||
|
@ -5,6 +5,17 @@ sidebar_position: 7
|
||||
|
||||
# 更新日志
|
||||
|
||||
## v3.24.0 - 2023-04-15
|
||||
|
||||
- 修复带有别名的 task 的 Fish shell 补全 ([#1113](https://github.com/go-task/task/issues/1113) by [@patricksjackson](https://github.com/patricksjackson))。
|
||||
- 默认分支已从 `master` 重命名为 `main` ([#1049](https://github.com/go-task/task/issues/1049), [#1048](https://github.com/go-task/task/issues/1048) by [@pd93](https://github.com/pd93))。
|
||||
- 修复静默任务未省略“up-to-date”日志的错误 ([#546](https://github.com/go-task/task/issues/546), [#1107](https://github.com/go-task/task/issues/1107) by [@danquah](https://github.com/danquah))。
|
||||
- 使用 `--watch` 时将 `.hg` (Mercurial) 添加到忽略目录列表 ([#1098](https://github.com/go-task/task/issues/1098) by [@misery](https://github.com/misery))。
|
||||
- 对发布工具的更多改进 ([#1096](https://github.com/go-task/task/issues/1096) by [@pd93](https://github.com/pd93))。
|
||||
- 强制执行 [gofumpt](https://github.com/mvdan/gofumpt) linter ([#1099](https://github.com/go-task/task/issues/1099) by [@pd93](https://github.com/pd93))
|
||||
- 添加 `--sort` 标志以与 `--list` 和 `--list-all` 一起使用 ([#946](https://github.com/go-task/task/issues/946), [#1105](https://github.com/go-task/task/issues/1105) by [@pd93](https://github.com/pd93))。
|
||||
- Task 现在根据错误具有 [自定义退出代码](https://taskfile.dev/api/#exit-codes) ([#1114](https://github.com/go-task/task/issues/1114) by [@pd93](https://github.com/pd93))。
|
||||
|
||||
## v3.23.0 - 2023-03-26
|
||||
|
||||
Task 现在已经有了一个由 [@pd93](https://github.com/pd93) 贡献的 [Visual Studio Code 官方扩展程序](https://marketplace.visualstudio.com/items?itemName=task.vscode-task)! :tada:该扩展现在在 `go-task` 组织的 [新存储库](https://github.com/go-task/vscode-task) 中进行维护。 我们希望从社区收集反馈,请尝试并通过[discussion](https://github.com/go-task/vscode-task/discussions)、 [issue](https://github.com/go-task/vscode-task/issues) 或 [Discord](https://discord.gg/6TY36E39UK) 告诉我们您的想法!
|
||||
@ -14,8 +25,7 @@ Task 现在已经有了一个由 [@pd93](https://github.com/pd93) 贡献的 [Vis
|
||||
- The website was integrated with [Crowdin](https://crowdin.com/project/taskfile) to allow the community to contribute with translations! [Chinese](https://taskfile.dev/zh-Hans/) is the first language available ([#1057](https://github.com/go-task/task/issues/1057), [#1058](https://github.com/go-task/task/issues/1058) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added task location data to the `--json` flag output ([#1056](https://github.com/go-task/task/issues/1056) by [@pd93](https://github.com/pd93))
|
||||
- Change the name of the file generated by `task --init` from `Taskfile.yaml` to `Taskfile.yml` ([#1062](https://github.com/go-task/task/issues/1062) by [@misitebao](https://github.com/misitebao)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar
|
||||
baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Added new `splitArgs` template function (`{{splitArgs "foo bar 'foo bar baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-task/task/issues/1040), [#1059](https://github.com/go-task/task/issues/1059) by [@dhanusaputra](https://github.com/dhanusaputra)).
|
||||
- Fix the value of `{{.CHECKSUM}}` variable in status ([#1076](https://github.com/go-task/task/issues/1076), [#1080](https://github.com/go-task/task/issues/1080) by [@pd93](https://github.com/pd93)).
|
||||
- Fixed deep copy implementation ([#1072](https://github.com/go-task/task/issues/1072) by [@pd93](https://github.com/pd93))
|
||||
- Created a tool to assist with releases ([#1086](https://github.com/go-task/task/issues/1086) by [@pd93](https://github.com/pd93)).
|
||||
@ -40,8 +50,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
- Improve behavior and performance of status checking when using the `timestamp` mode ([#976](https://github.com/go-task/task/issues/976), [#977](https://github.com/go-task/task/issues/977) by [@aminya](https://github.com/aminya)).
|
||||
- Performance optimizations were made for large Taskfiles ([#982](https://github.com/go-task/task/issues/982) by [@pd93](https://github.com/pd93)).
|
||||
- Add ability to configure options for the [`set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html) and [`shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) builtins ([#908](https://github.com/go-task/task/issues/908), [#929](https://github.com/go-task/task/issues/929) by [@pd93](https://github.com/pd93), [Documentation](http://taskfile.dev/usage/#set-and-shopt)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms:
|
||||
[linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
- Add new `platforms:` attribute to `task` and `cmd`, so it's now possible to choose in which platforms that given task or command will be run on. Possible values are operating system (GOOS), architecture (GOARCH) or a combination of the two. Example: `platforms: [linux]`, `platforms: [amd64]` or `platforms: [linux/amd64]`. Other platforms will be skipped ([#978](https://github.com/go-task/task/issues/978), [#980](https://github.com/go-task/task/issues/980) by [@leaanthony](https://github.com/leaanthony)).
|
||||
|
||||
## v3.19.1 - 2022-12-31
|
||||
|
||||
@ -151,8 +160,7 @@ baz'"}}`) to ensure string is split as arguments ([#1040](https://github.com/go-
|
||||
|
||||
## v3.9.0 - 2021-10-02
|
||||
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a
|
||||
string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- A new `shellQuote` function was added to the template system (`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https://github.com/go-task/task/issues/727)](https://github.com/mvdan/sh/pull/727), [mvdan/sh\[#737\](https://github.com/go-task/task/issues/737)](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3[@v3](https://github.com/v3).4.0/syntax#Quote))
|
||||
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with some small fixes and features
|
||||
- The `read -p` flag is now supported ([#314](https://github.com/go-task/task/issues/314), [mvdan/sh\[#551\](https://github.com/go-task/task/issues/551)](https://github.com/mvdan/sh/issues/551), [mvdan/sh\[#772\](https://github.com/go-task/task/issues/772)](https://github.com/mvdan/sh/pull/722))
|
||||
- The `pwd -P` and `pwd -L` flags are now supported ([#553](https://github.com/go-task/task/issues/553), [mvdan/sh\[#724\](https://github.com/go-task/task/issues/724)](https://github.com/mvdan/sh/issues/724), [mvdan/sh\[#728\](https://github.com/go-task/task/issues/728)](https://github.com/mvdan/sh/pull/728))
|
||||
@ -327,7 +335,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
- Added support for [including other Taskfiles](https://taskfile.org/#/usage?id=including-other-taskfiles) ([#98](https://github.com/go-task/task/issues/98))
|
||||
- This should be considered experimental. For now, only including local files is supported, but support for including remote Taskfiles is being discussed. If you have any feedback, please comment on [#98](https://github.com/go-task/task/issues/98).
|
||||
- Task now have a dedicated documentation site: https://taskfile.org
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/master/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/main/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
|
||||
## v2.1.1 - 2018-09-17
|
||||
|
||||
@ -359,7 +367,7 @@ string"}}`) to ensure a string is safe for use in shell ([mvdan/sh\[#727\](https
|
||||
|
||||
Version 2.0.0 is here, with a new Taskfile format.
|
||||
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/master/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/main/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
|
||||
- New Taskfile version 2 ([#77](https://github.com/go-task/task/issues/77))
|
||||
- Possibility to have global variables in the `Taskfile.yml` instead of `Taskvars.yml` ([#66](https://github.com/go-task/task/issues/66))
|
||||
|
@ -15,7 +15,7 @@ sidebar_position: 8
|
||||
|
||||
### JSON Schema
|
||||
|
||||
Schema 的初步工作是由 [@KROSF](https://github.com/KROSF) 在此 [Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895) 上完成的。 这个 Schema 目前在 https://taskfile.dev/schema.json 上可用,并在 https://json.schemastore.org/taskfile.json 上添加了链接,因此它可以自动在许多代码编辑器使用,例如 VSCode。 可以通过编辑 [此文件](https://github.com/go-task/task/blob/master/docs/static/schema.json) 来完成贡献。
|
||||
Schema 的初步工作是由 [@KROSF](https://github.com/KROSF) 在此 [Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895) 上完成的。 这个 Schema 目前在 https://taskfile.dev/schema.json 上可用,并在 https://json.schemastore.org/taskfile.json 上添加了链接,因此它可以自动在许多代码编辑器使用,例如 VSCode。 可以通过编辑 [此文件](https://github.com/go-task/task/blob/main/docs/static/schema.json) 来完成贡献。
|
||||
|
||||
### Visual Studio Code 扩展
|
||||
|
||||
|
@ -14,9 +14,9 @@ sidebar_position: 9
|
||||
|
||||
## 1. 设置
|
||||
|
||||
- **Go** - Task 使用 [Go](https://go.dev) 编写。 我们始终支持最新的两个主要 Go 版本,因此请确保您的版本足够新。
|
||||
- **Node.js** - [Node.js](https://nodejs.org/en/) 用于托管 Task 的文档服务器,如果您想在本地运行此服务器,则需要它。
|
||||
- **Yarn** - [Yarn](https://yarnpkg.com/) 是 Task 使用的 Node.js 包管理器。
|
||||
- **Go** - Task 使用 [Go][go] 编写。 我们始终支持最新的两个主要 Go 版本,因此请确保您的版本足够新。
|
||||
- **Node.js** - [Node.js][nodejs] 用于托管 Task 的文档服务器,如果您想在本地运行此服务器,则需要它。
|
||||
- **Yarn** - [Yarn][yarn] 是 Task 使用的 Node.js 包管理器。
|
||||
|
||||
## 2. 进行变更
|
||||
|
||||
@ -35,7 +35,7 @@ Task 用 [Docusaurus](https://docusaurus.io) 托管文档服务。 这可以通
|
||||
|
||||
进行变更时,请考虑是否有必要更改 [使用指南](./usage.md)。 本文档包含有关如何使用任务功能的说明和示例。 如果您要添加新功能,请尝试找到合适的位置来添加新部分。 如果您要更新现有功能,请确保文档和所有示例都是最新的。 确保任何示例都遵循 [Taskfile 风格指南](./styleguide.md)。
|
||||
|
||||
如果您添加了新字段、命令或标志,请确保将其添加到 [API 参考](./api_reference.md) 中。 还需要将新字段添加到 [JSON Schema](https://github.com/go-task/task/blob/master/docs/static/schema.json) 中。 API 参考和 schema 中的字段描述应该匹配。
|
||||
如果您添加了新字段、命令或标志,请确保将其添加到 [API 参考](./api_reference.md) 中。 还需要将新字段添加到 [JSON Schema][json-schema] 中。 API 参考和 schema 中的字段描述应该匹配。
|
||||
|
||||
### 编写测试
|
||||
|
||||
@ -58,16 +58,24 @@ Task 的大部分测试都保存在项目根目录的 `task_test.go` 文件中
|
||||
|
||||
> 我想贡献,我从哪里开始?
|
||||
|
||||
查看 [未解决 Issue](https://github.com/go-task/task/issues) 的列表。 我们有一个 [good first issue](https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 标签,用于更简单的问题,非常适合首次贡献。
|
||||
查看 [未解决 Issue][open-issues] 的列表。 我们有一个 [good first issue][good-first-issue] 标签,用于更简单的问题,非常适合首次贡献。
|
||||
|
||||
欢迎各种贡献,无论是拼写错误修复还是很小的新功能。 您还可以通过对 Issue 进行投票/评论、帮助回答问题或帮助 [其他社区项目](./community.md) 来做出贡献。
|
||||
|
||||
> 我被困住了,我在哪里可以获得帮助?
|
||||
|
||||
如果您有任何疑问,请随时在我们的 [Discord 服务器](https://discord.gg/6TY36E39UK) 上的 `#help` 论坛频道中提问,或在 GitHub 上打开 [讨论](https://github.com/go-task/task/discussions)。
|
||||
如果您有任何疑问,请随时在我们的 [Discord 服务器][discord-server] 上的 `#help` 论坛频道中提问,或在 GitHub 上打开 [讨论][discussion]。
|
||||
|
||||
---
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://go.dev
|
||||
[nodejs]: https://nodejs.org/en/
|
||||
[yarn]: https://yarnpkg.com/
|
||||
[json-schema]: https://github.com/go-task/task/blob/main/docs/static/schema.json
|
||||
[open-issues]: https://github.com/go-task/task/issues
|
||||
[good-first-issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
[discord-server]: https://discord.gg/6TY36E39UK
|
||||
[discussion]: https://github.com/go-task/task/discussions
|
||||
|
@ -9,7 +9,7 @@ sidebar_position: 12
|
||||
|
||||
这只是一种表达“感谢”的方式,它不会给你任何好处,比如在 Issue 上的更高优先级或类似的东西。
|
||||
|
||||
每月捐赠至少 50 美元的公司将在网站主页和 GitHub 存储库 README 中被标为“金牌赞助商”。 请与 [@andreynering](https://github.com/andreynering) 联系,说明你希望显示的标志。 不过,可疑的企业(赌博、赌场等)将不被允许。
|
||||
每月捐赠至少 50 美元的公司将在网站主页和 GitHub 存储库 README 中被标为“金牌赞助商”。 请与 [@andreynering][] 联系,说明你希望显示的标志。 不过,可疑的企业(赌博、赌场等)将不被允许。
|
||||
|
||||
## GitHub Sponsors
|
||||
|
||||
@ -30,14 +30,15 @@ sidebar_position: 12
|
||||
|
||||
## PayPal
|
||||
|
||||
你也可以通过 PayPal 向 [@andreynering](https://github.com/andreynering) 捐款。
|
||||
你也可以通过 PayPal 向 [@andreynering][] 捐款。
|
||||
|
||||
- [任何金额 - 一次性捐款](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url)
|
||||
|
||||
## PIX (仅巴西)
|
||||
|
||||
如果你是巴西人,你也可以通过 PIX [使用这个QR码](/img/pix.png) 向 [@andreynering](https://github.com/andreynering) 捐款。
|
||||
如果你是巴西人,你也可以通过 PIX [使用这个QR码](/img/pix.png) 向 [@andreynering][] 捐款。
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[@andreynering]: https://github.com/andreynering
|
||||
|
@ -31,7 +31,7 @@ Windows 上的默认 shell(`cmd` 和 `powershell`)没有像 `rm` 和 `cp`
|
||||
|
||||
- 使用 `{{OS}}` 函数运行特定于操作系统的脚本。
|
||||
- 使用 `{{if eq OS "windows"}}powershell {{end}}<my_cmd>` 之类的东西来检测 windows 并直接在 Powershell 中运行命令。
|
||||
- 在 Windows 上使用支持这些命令的 shell 作为内置命令,例如 [Git Bash](https://gitforwindows.org/) 或 [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)。
|
||||
- 在 Windows 上使用支持这些命令的 shell 作为内置命令,例如 [Git Bash][git-bash] 或 [WSL][wsl]。
|
||||
|
||||
我们希望对 Task 的这一部分进行改进,下面的 Issue 会跟踪这项工作。 非常欢迎建设性的意见和贡献!
|
||||
|
||||
@ -42,3 +42,5 @@ Windows 上的默认 shell(`cmd` 和 `powershell`)没有像 `rm` 和 `cp`
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[git-bash]: https://gitforwindows.org/
|
||||
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
|
||||
|
@ -27,7 +27,7 @@ brew install go-task
|
||||
|
||||
### Snap
|
||||
|
||||
Task 在 [Snapcraft](https://snapcraft.io/task) 中可用,但请记住,您的 Linux 发行版应该符合 Snaps 的基本要求才能正确安装:
|
||||
Task 在 [Snapcraft][snapcraft] 中可用,但请记住,您的 Linux 发行版应该符合 Snaps 的基本要求才能正确安装:
|
||||
|
||||
```bash
|
||||
sudo snap install task --classic
|
||||
@ -35,7 +35,7 @@ sudo snap install task --classic
|
||||
|
||||
### Chocolatey
|
||||
|
||||
如果 Windows 上安装了 [Chocolatey](https://chocolatey.org/),再安装 Task 只要这样:
|
||||
如果 Windows 上安装了 [Chocolatey][choco],再安装 Task 只要这样:
|
||||
|
||||
```bash
|
||||
choco install go-task
|
||||
@ -45,7 +45,7 @@ choco install go-task
|
||||
|
||||
### Scoop
|
||||
|
||||
如果 Windows 上安装了 [Scoop](https://scoop.sh/),再安装 Task 只要这样:
|
||||
如果 Windows 上安装了 [Scoop][scoop],再安装 Task 只要这样:
|
||||
|
||||
```cmd
|
||||
scoop install task
|
||||
@ -109,7 +109,7 @@ winget install Task.Task
|
||||
|
||||
### 二进制文件
|
||||
|
||||
您可以从 [GitHub 上的发布页面](https://github.com/go-task/task/releases) 下载二进制文件并添加到您的 `$PATH` 中。
|
||||
您可以从 [GitHub 上的发布页面][releases] 下载二进制文件并添加到您的 `$PATH` 中。
|
||||
|
||||
还支持 DEB 和 RPM 包。
|
||||
|
||||
@ -117,7 +117,7 @@ winget install Task.Task
|
||||
|
||||
### 安装脚本
|
||||
|
||||
我们还有一个 [安装脚本](https://github.com/go-task/task/blob/master/install-task.sh),它在 CI 等场景中非常有用。 非常感谢 [GoDownloader](https://github.com/goreleaser/godownloader) 使这个脚本的生成变得容易。
|
||||
我们还有一个 [安装脚本][installscript],它在 CI 等场景中非常有用。 非常感谢 [GoDownloader](https://github.com/goreleaser/godownloader) 使这个脚本的生成变得容易。
|
||||
|
||||
默认情况下,它安装在相对于工作目录的 `./bin` 目录中:
|
||||
|
||||
@ -133,12 +133,10 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
|
||||
:::caution
|
||||
|
||||
|
||||
在 macOS 和 Windows 上,`~/.local/bin` 和 `~/bin` 默认情况下不会添加到 `$PATH`。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
如果你想在 GitHub Actions 中安装 Task,你可以尝试使用 Arduino 团队的 [这个 action](https://github.com/arduino/setup-task):
|
||||
@ -157,7 +155,7 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
|
||||
### Go Modules
|
||||
|
||||
确保您已正确安装和设置受支持的 [Go](https://golang.org/) 版本。 您可以在 [go.mod](https://github.com/go-task/task/blob/master/go.mod#L3) 文件中找到最低要求的 Go 版本。
|
||||
确保您已正确安装和设置受支持的 [Go][go] 版本。 您可以在 [go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) 文件中找到最低要求的 Go 版本。
|
||||
|
||||
然后,您可以通过运行以下命令全局安装最新版本:
|
||||
|
||||
@ -173,17 +171,15 @@ env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
对于 CI 环境,我们建议改用 [安装脚本](#安装脚本),它更快更稳定,因为它只会下载最新发布的二进制文件。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 自动完成
|
||||
|
||||
下载与您的 shell 对应的自动完成文件。
|
||||
|
||||
[所有自动完成都在任务存储库中可用](https://github.com/go-task/task/tree/master/completion)。
|
||||
[所有自动完成都在 Task 存储库中可用](https://github.com/go-task/task/tree/main/completion)。
|
||||
|
||||
### Bash
|
||||
|
||||
@ -244,3 +240,9 @@ Invoke-Expression -Command path/to/task.ps1
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[go]: https://golang.org/
|
||||
[snapcraft]: https://snapcraft.io/task
|
||||
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[choco]: https://chocolatey.org/
|
||||
[scoop]: https://scoop.sh/
|
||||
|
@ -10,11 +10,11 @@ title: 主页
|
||||
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
|
||||
</div>
|
||||
|
||||
Task 是一个任务运行器/构建工具,旨在比 [GNU Make](https://www.gnu.org/software/make/) 等更简单易用。
|
||||
Task 是一个任务运行器/构建工具,旨在比 [GNU Make][make] 等更简单易用。
|
||||
|
||||
由于它是用 [Go](https://go.dev/) 编写的,Task 只是一个二进制文件,没有其他依赖项,这意味着您不需要为了使用构建工具而烦恼任何复杂的安装设置。
|
||||
|
||||
[安装](installation.md) 后,您只需在名为 `Taskfile.yml` 的文件中使用简单的 [YAML](http://yaml.org/) 规则描述您的构建任务:
|
||||
[安装](installation.md) 后,您只需在名为 `Taskfile.yml` 的文件中使用简单的 [YAML][yaml] 规则描述您的构建任务:
|
||||
|
||||
```yaml title="Taskfile.yml"
|
||||
version: '3'
|
||||
@ -50,3 +50,5 @@ tasks:
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[yaml]: http://yaml.org/
|
||||
|
@ -5,9 +5,9 @@ sidebar_position: 10
|
||||
|
||||
# 发布
|
||||
|
||||
Task 的发布流程是在 [GoReleaser](https://goreleaser.com/) 的帮助下完成的。 本地调用 Taskfile 的 `test-release` task 可以测试发布流程。
|
||||
Task 的发布流程是在 [GoReleaser][goreleaser] 的帮助下完成的。 本地调用 Taskfile 的 `test-release` task 可以测试发布流程。
|
||||
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) 会在新 tag 推送到 master 分支的时候,自动发布产出物(原生的可执行文件、DEB 和 RPM 包)。
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) 会在新 tag 推送到 `main` 分支的时候,自动发布产出物(原生的可执行文件、DEB 和 RPM 包)。
|
||||
|
||||
从 v3.15.0 开始,原始可执行文件也可以通过检查特定的标签并调用 `goreleaser build`,使用上述 GitHub Actions 中定义的 Go 版本,在本地进行复制和验证。
|
||||
|
||||
@ -17,14 +17,14 @@ Goreleaser 会自动向 [Homebrew tap](https://github.com/go-task/homebrew-tap)
|
||||
|
||||
# npm
|
||||
|
||||
要发布到 npm ,请更新 [`package.json`](https://github.com/go-task/task/blob/master/package.json#L3) 文件中的版本,然后运行 `task npm:publish` 来推送它。
|
||||
要发布到 npm ,请更新 [`package.json`][packagejson] 文件中的版本,然后运行 `task npm:publish` 来推送它。
|
||||
|
||||
# Snapcraft
|
||||
|
||||
[snap package](https://github.com/go-task/snap) 发布新版本需要手动执行下面步骤:
|
||||
|
||||
- 更新 [snapcraft.yaml](https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2) 文件中的版本。
|
||||
- 把新的 `amd64`, `armhf` 和 `arm64` 移动到 [Snapcraft dashboard](https://snapcraft.io/task/releases) 的稳定通道。
|
||||
- 把新的 `amd64`, `armhf` 和 `arm64` 移动到 [Snapcraft dashboard][snapcraftdashboard] 的稳定通道。
|
||||
|
||||
# Scoop
|
||||
|
||||
@ -37,3 +37,6 @@ Nix 安装由社区维护。 Nix 包的维护人员通常会在 [这个文件](h
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[goreleaser]: https://goreleaser.com/
|
||||
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
|
||||
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||
|
@ -89,7 +89,7 @@ tasks:
|
||||
|
||||
## 版本 2.1
|
||||
|
||||
2.1 版包括一个全局 `output` 选项,以允许更好地控制如何将命令输出打印到控制台(有关更多信息,请参阅 [文档](usage.md#输出语法)):
|
||||
2.1 版包括一个全局 `output` 选项,以允许更好地控制如何将命令输出打印到控制台(有关更多信息,请参阅 [文档][output]):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -103,7 +103,7 @@ tasks:
|
||||
prefix: server
|
||||
```
|
||||
|
||||
从这个版本开始,也可以忽略命令或 task 的错误(在 [此处](usage.md#忽略错误) 查看文档):
|
||||
从这个版本开始,也可以忽略命令或 task 的错误(在 [此处][ignore_errors] 查看文档):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@ -149,7 +149,7 @@ tasks:
|
||||
- aws s3 cp .env s3://myenvironment
|
||||
```
|
||||
|
||||
请检查 [文档](usage.md#包含其他-taskfile)
|
||||
请检查 [文档][includes]
|
||||
|
||||
## 版本 3
|
||||
|
||||
@ -202,3 +202,7 @@ tasks:
|
||||
- 全局或 CLI 变量
|
||||
- 调用变量
|
||||
- Task 内的变量
|
||||
|
||||
[output]: usage.md#输出语法
|
||||
[ignore_errors]: usage.md#忽略错误
|
||||
[includes]: usage.md#包含其他-taskfile
|
||||
|
@ -7,10 +7,12 @@ sidebar_position: 13
|
||||
|
||||
想帮助我们翻译此文档吗? 在本文档中,我们解释了如何解决这一问题。
|
||||
|
||||
不要直接在 GitHub 存储库上编辑翻译后的 markdown 文件! 我们使用 [Crowdin](https://crowdin.com/project/taskfile) 来允许贡献者进行翻译工作。 存储库会根据 Crowdin 的进展定期更新。
|
||||
不要直接在 GitHub 存储库上编辑翻译后的 markdown 文件! 我们使用 [Crowdin][crowdin] 来允许贡献者进行翻译工作。 存储库会根据 Crowdin 的进展定期更新。
|
||||
|
||||
如果您想访问 Crowdin 项目以提供翻译建议,请在 [我们的 Discord 服务器上的 #translations 频道](https://discord.gg/6TY36E39UK) 上申请访问权限。 如果给定的语言尚未显示给 Crowdin,请询问,我们可以对其进行配置。
|
||||
如果您想访问 Crowdin 项目以提供翻译建议,请在 [我们的 Discord 服务器上的 #translations 频道][discord] 上申请访问权限。 如果给定的语言尚未显示给 Crowdin,请询问,我们可以对其进行配置。
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[crowdin]: https://crowdin.com/project/taskfile
|
||||
[discord]: https://discord.gg/6TY36E39UK
|
||||
|
@ -71,10 +71,9 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
当使用 `-g` 运行全局 Taskfile 时,task 将默认在 `$HOME` 上运行,而不是在您的工作目录上!
|
||||
|
||||
When running your global Taskfile with `-g`, tasks will run on `$HOME` by default, and not on your working directory!
|
||||
|
||||
As mentioned in the previous section, the `{{.USER_WORKING_DIR}}` special variable can be very handy here to run stuff on the directory you're calling `task -g` from.
|
||||
如前一节所述,`{{.USER_WORKING_DIR}}` 特殊变量在这里可以非常方便地在您从中调用 `task -g` 的目录中运行内容。
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -92,7 +91,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 环境变量
|
||||
|
||||
### Task
|
||||
@ -126,12 +124,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
`env` 支持扩展和检索 shell 命令的输出,就像变量一样,如您在 [变量](#变量) 部分中看到的那样。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### .env 文件
|
||||
|
||||
您还可以使用 `dotenv:` 设置要求 tasks 包含 `.env` 之类的文件
|
||||
@ -192,12 +188,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
请注意,您目前无法在包含的 Taskfile 中使用 `dotenv` 键。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 包含其他 Taskfile
|
||||
|
||||
如果要在不同项目(Taskfile)之间共享任务,可以使用导入机制使用 `includes` 关键字包含其他任务文件:
|
||||
@ -240,12 +234,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
包含的 Taskfile 必须使用与主 Taskfile 使用的相同规则版本。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### 可选 includes
|
||||
|
||||
如果包含文件丢失,标记为可选的包含将允许 task 继续正常执行。
|
||||
@ -312,15 +304,13 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Vars declared in the included Taskfile have preference over the variables in the including Taskfile! If you want a variable in an included Taskfile to be overridable, use the [default function](https://go-task.github.io/slim-sprig/defaults.html): `MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`.
|
||||
在包含的 Taskfile 中声明的变量优先于包含 Taskfile 中的变量! 如果您希望包含的 Taskfile 中的变量可被覆盖,请使用 [默认方法](https://go-task.github.io/slim-sprig/defaults.html):`MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 内部 tasks
|
||||
|
||||
Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running `task --list|--list-all`. Other tasks may call internal tasks in the usual way. This is useful for creating reusable, function-like tasks that have no useful purpose on the command line.
|
||||
内部 task 是用户不能直接调用的 task。 运行 `task --list|--list-all` 时,它们不会出现在输出中。 其他 task 可以照常调用内部 task。 这对于创建在命令行上没有用处的可重用、类似函数的 task 很有用。
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -359,7 +349,7 @@ tasks:
|
||||
|
||||
> 依赖项并行运行,因此一项 task 的依赖项不应相互依赖。 如果您想强制任务顺序运行,请查看下面的 [调用另一个 task](#调用另一个-task) 部分。
|
||||
|
||||
您可能有依赖于其它的 task。 Just pointing them on `deps` will make them run automatically before running the parent task:
|
||||
您可能有依赖于其它的 task。 将它们指向 `deps` 将使它们在运行父 task 之前自动运行:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -399,13 +389,11 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
You can also make the tasks given by the command line run in parallel by using the `--parallel` flag (alias `-p`). 例如: `task --parallel js css`。
|
||||
您还可以使用 `--parallel` 标志(别名 `-p`)使命令行给出的 task 并行运行。 例如: `task --parallel js css`。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
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):
|
||||
如果你想将信息传递给依赖项,你可以像 [调用另一个 task](#调用另一个-task) 一样以相同的方式进行:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -427,11 +415,11 @@ tasks:
|
||||
|
||||
## 平台特定的 tasks 和 cmds
|
||||
|
||||
If you want to restrict the running of tasks to explicit platforms, this can be achieved using the `platforms:` key. Tasks can be restricted to a specific OS, architecture or a combination of both. On a mismatch, the task or command will be skipped, and no error will be thrown.
|
||||
如果您想将 task 的运行限制在明确的平台上,可以使用 `platforms:` 键来实现。 Task 可以限制在特定的操作系统、架构或两者的组合中。 如果不匹配,任务或命令将被跳过,并且不会抛出任何错误。
|
||||
|
||||
允许作为 OS 或 Arch 的值是有效的 `GOOS` 和 `GOARCH` 值,正如 [此处](https://github.com/golang/go/blob/master/src/go/build/syslist.go) 的 Go 语言所定义的那样。
|
||||
|
||||
The `build-windows` task below will run only on Windows, and on any architecture:
|
||||
下面的 `build-windows` task 将仅在 Windows 所有架构上运行:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -494,7 +482,7 @@ tasks:
|
||||
|
||||
## 调用另一个 task
|
||||
|
||||
当一个 task 有很多依赖时,它们是并发执行的。 这通常会导致更快的构建管道。 However, in some situations, you may need to call other tasks serially. 在这种情况下,请使用以下语法:
|
||||
当一个 task 有很多依赖时,它们是并发执行的。 这通常会导致更快的构建管道。 但是,在某些情况下,您可能需要串行调用其他 task。 在这种情况下,请使用以下语法:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -537,12 +525,10 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
注意:如果您想从 [包含的 Taskfile](#包含其他-taskfile) 中调用在根 Taskfile 中声明的 task,请像这样添加 `:` 前缀:`task: :task-name`。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 减少不必要的工作
|
||||
|
||||
### 通过指纹识别本地生成的文件及其来源
|
||||
@ -575,9 +561,9 @@ tasks:
|
||||
- public/bundle.css
|
||||
```
|
||||
|
||||
`sources` and `generates` can be files or file patterns. When given, Task will compare the checksum of the source files to determine if it's necessary to run the task. If not, it will just print a message like `Task "js" is up to date`.
|
||||
`sources` 和 `generates` 可以配置具体文件或者使用匹配模式。 设置后, Task 会根据源文件的 checksum 来确定是否需要执行当前任务。 如果不需要执行, 则会输出像 `Task "js" is up to date` 这样的信息。
|
||||
|
||||
If you prefer this check to be made by the modification timestamp of the files, instead of its checksum (content), just set the `method` property to `timestamp`.
|
||||
如果您希望通过文件的修改 timestamp 而不是其 checksum(内容)来进行此检查,只需将 `method` 属性设置为 `timestamp` 即可。
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -597,10 +583,9 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
默认情况,task 在本地项目的 `.task` 目录保存 checksums 值。 一般都会在 `.gitignore`(或类似配置)中忽略掉这个目录,这样它就不会被提交。 (If you have a task for code generation that is committed it may make sense to commit the checksum of that task as well, though).
|
||||
|
||||
By default, task stores checksums on a local `.task` directory in the project's directory. Most of the time, you'll want to have this directory on `.gitignore` (or equivalent) so it isn't committed. (If you have a task for code generation that is committed it may make sense to commit the checksum of that task as well, though).
|
||||
|
||||
If you want these files to be stored in another directory, you can set a `TASK_TEMP_DIR` environment variable in your machine. It can contain a relative path like `tmp/task` that will be interpreted as relative to the project directory, or an absolute or home path like `/tmp/.task` or `~/.task` (subdirectories will be created for each project).
|
||||
如果你想要将这些文件存储在另一个目录中,你可以在你的机器中设置一个 `TASK_TEMP_DIR` 环境变量。 可以使用相对路径,比如 `tmp/task`,相对项目根目录,也可以用绝对路径、用户目录路径,比如 `/tmp/.task` 或 `~/.task`(每个项目单独创建子目录)。
|
||||
|
||||
```bash
|
||||
export TASK_TEMP_DIR='~/.task'
|
||||
@ -608,34 +593,27 @@ export TASK_TEMP_DIR='~/.task'
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Each task has only one checksum stored for its `sources`. If you want to distinguish a task by any of its input variables, you can add those variables as part of the task's label, and it will be considered a different task.
|
||||
|
||||
This is useful if you want to run a task once for each distinct set of inputs until the sources actually change. For example, if the sources depend on the value of a variable, or you if you want the task to rerun if some arguments change even if the source has not.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
将 method 设置为 `none` 会跳过任何验证并始终运行任务。
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
For the `checksum` (default) or `timestamp` method to work, it is only necessary to inform the source files. When the `timestamp` method is used, the last time of the running the task is considered as a generate.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Using programmatic checks to indicate a task is up to date
|
||||
### 使用程序检查来表示任务是最新的
|
||||
|
||||
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:
|
||||
|
||||
@ -788,12 +766,10 @@ $ TASK_VARIABLE=a-value task do-something
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
A special variable `.TASK` is always available containing the task name.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
Since some shells do not support the above syntax to set environment variables (Windows) tasks also accept a similar style when not at the beginning of the command.
|
||||
|
||||
```bash
|
||||
@ -881,7 +857,7 @@ tasks:
|
||||
- echo 'Do work on tmpdir/'
|
||||
```
|
||||
|
||||
If you want to move the cleanup command into another task, that is possible as well:
|
||||
使用其它 task 作为清理任务的命令时,可以这样:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -898,15 +874,13 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Due to the nature of how the [Go's own `defer` work](https://go.dev/tour/flowcontrol/13), the deferred commands are executed in the reverse order if you schedule multiple of them.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Go 的模板引擎
|
||||
|
||||
Task parse commands as [Go's template engine](https://golang.org/pkg/text/template/) before executing them. 可以通过点语法 (`.VARNAME`) 访问变量。
|
||||
Task 在执行命令之前将命令解析为 [Go 的模板引擎][gotemplate]。 可以通过点语法 (`.VARNAME`) 访问变量。
|
||||
|
||||
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:
|
||||
|
||||
@ -1038,7 +1012,7 @@ Please note: _showing the summary will not execute the command_.
|
||||
|
||||
## Task 别名
|
||||
|
||||
Aliases 是 task 的替代名称。 它们可以使运行具有长名称或难以键入名称的 task 变得更加容易和快速。 您可以在命令行上使用它们,在您的 Taskfile 中 [调用子任务](#调用另一个-task) 时以及在 [包含来自另一个 Taskfile](#包含其他-taskfile) 的别名 task 时。 They can also be used together with [namespace aliases](#namespace-aliases).
|
||||
Aliases 是 task 的替代名称。 它们可以使运行具有长名称或难以键入名称的 task 变得更加容易和快速。 您可以在命令行上使用它们,在您的 Taskfile 中 [调用子任务](#调用另一个-task) 时以及在 [包含来自另一个 Taskfile](#包含其他-taskfile) 的别名 task 时。 它们也可以与 [命名空间别名](#命名空间别名) 一起使用。
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
@ -1291,12 +1265,10 @@ $ task default
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The `output` option can also be specified by the `--output` or `-o` flags.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 交互式 CLI 应用
|
||||
|
||||
When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the [output mode](#output-syntax) is set to something other than `interleaved` (the default), or when interactive apps are run in parallel with other tasks.
|
||||
@ -1347,12 +1319,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Keep in mind that not all options are available in the [shell interpreter library](https://github.com/mvdan/sh) that Task uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## 观察任务
|
||||
|
||||
With the flags `--watch` or `-w` task will watch for file changes and run the task again. This requires the `sources` attribute to be given, so task knows which files to watch.
|
||||
@ -1362,3 +1332,4 @@ The default watch interval is 5 seconds, but it's possible to change it by eithe
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
|
Loading…
Reference in New Issue
Block a user