From 11471528388fe652735da893d89f9fe21bdf5092 Mon Sep 17 00:00:00 2001 From: task-bot <106601941+task-bot@users.noreply.github.com> Date: Sun, 28 May 2023 20:56:02 +0000 Subject: [PATCH] deploy: e0d3e33c32cfa0c99afd95b74086852983603a51 --- pt-BR/404.html | 4 ++-- pt-BR/api/index.html | 6 +++--- pt-BR/assets/js/19a1e173.f78a02ec.js | 1 + pt-BR/assets/js/19a1e173.fa0df646.js | 1 - pt-BR/assets/js/19b14462.1ef0ded7.js | 1 + pt-BR/assets/js/19b14462.ffc50926.js | 1 - pt-BR/assets/js/31fd616d.cfc7c78e.js | 1 + pt-BR/assets/js/31fd616d.d6792d13.js | 1 - pt-BR/assets/js/4a484b02.0b0dd730.js | 1 - pt-BR/assets/js/4a484b02.5e12d515.js | 1 + pt-BR/assets/js/6905f42e.284fd962.js | 1 - pt-BR/assets/js/6905f42e.e4f764bf.js | 1 + pt-BR/assets/js/8420b8df.3538c872.js | 1 - pt-BR/assets/js/8420b8df.dd8684c7.js | 1 + pt-BR/assets/js/935f2afb.3a9c3e69.js | 1 - pt-BR/assets/js/935f2afb.c53862c1.js | 1 + pt-BR/assets/js/ad872c75.5776bf79.js | 1 + pt-BR/assets/js/ad872c75.7e629dc5.js | 1 - pt-BR/assets/js/b9256968.5f33e496.js | 1 + pt-BR/assets/js/b9256968.a17fa1ee.js | 1 - .../js/{d23ae857.0e7597ef.js => d23ae857.b36c887e.js} | 2 +- pt-BR/assets/js/e8ea0ffb.f8d1075f.js | 1 + pt-BR/assets/js/e8ea0ffb.fcf3a6b5.js | 1 - pt-BR/assets/js/ee2b4fdf.11b95856.js | 1 - pt-BR/assets/js/ee2b4fdf.827f92cd.js | 1 + pt-BR/assets/js/f2ae99f3.f0a7970f.js | 1 + pt-BR/assets/js/f2ae99f3.f2bfc858.js | 1 - pt-BR/assets/js/fcec3894.0cbe4614.js | 1 + pt-BR/assets/js/fcec3894.f0e483ef.js | 1 - pt-BR/assets/js/runtime~main.7e731106.js | 1 - pt-BR/assets/js/runtime~main.911b8743.js | 1 + pt-BR/changelog/index.html | 6 +++--- pt-BR/community/index.html | 8 ++++---- pt-BR/contributing/index.html | 6 +++--- pt-BR/donate/index.html | 6 +++--- pt-BR/faq/index.html | 8 ++++---- pt-BR/index.html | 8 ++++---- pt-BR/installation/index.html | 8 ++++---- pt-BR/integrations/index.html | 6 +++--- pt-BR/releasing/index.html | 6 +++--- pt-BR/search/index.html | 4 ++-- pt-BR/styleguide/index.html | 8 ++++---- pt-BR/taskfile-versions/index.html | 8 ++++---- pt-BR/translate/index.html | 6 +++--- pt-BR/usage/index.html | 6 +++--- ru-RU/404.html | 4 ++-- ru-RU/api/index.html | 4 ++-- .../js/{935f2afb.b0d9b4b1.js => 935f2afb.719cfa4f.js} | 2 +- ru-RU/assets/js/a9ffebd3.720c7079.js | 1 - ru-RU/assets/js/a9ffebd3.8774ce07.js | 1 + ...{runtime~main.8374a859.js => runtime~main.af0f7f13.js} | 2 +- ru-RU/changelog/index.html | 4 ++-- ru-RU/community/index.html | 4 ++-- ru-RU/contributing/index.html | 4 ++-- ru-RU/donate/index.html | 4 ++-- ru-RU/faq/index.html | 4 ++-- ru-RU/index.html | 4 ++-- ru-RU/installation/index.html | 4 ++-- ru-RU/integrations/index.html | 4 ++-- ru-RU/releasing/index.html | 8 ++++---- ru-RU/search/index.html | 4 ++-- ru-RU/styleguide/index.html | 4 ++-- ru-RU/taskfile-versions/index.html | 4 ++-- ru-RU/translate/index.html | 4 ++-- ru-RU/usage/index.html | 4 ++-- zh-Hans/404.html | 4 ++-- zh-Hans/api/index.html | 4 ++-- .../js/{1fd60438.121b35ab.js => 1fd60438.9968be29.js} | 2 +- ...{runtime~main.ec265e34.js => runtime~main.d1160671.js} | 2 +- zh-Hans/changelog/index.html | 4 ++-- zh-Hans/community/index.html | 4 ++-- zh-Hans/contributing/index.html | 4 ++-- zh-Hans/donate/index.html | 4 ++-- zh-Hans/faq/index.html | 4 ++-- zh-Hans/index.html | 4 ++-- zh-Hans/installation/index.html | 4 ++-- zh-Hans/integrations/index.html | 4 ++-- zh-Hans/releasing/index.html | 4 ++-- zh-Hans/search/index.html | 4 ++-- zh-Hans/styleguide/index.html | 4 ++-- zh-Hans/taskfile-versions/index.html | 6 +++--- zh-Hans/translate/index.html | 4 ++-- zh-Hans/usage/index.html | 4 ++-- 83 files changed, 139 insertions(+), 139 deletions(-) create mode 100644 pt-BR/assets/js/19a1e173.f78a02ec.js delete mode 100644 pt-BR/assets/js/19a1e173.fa0df646.js create mode 100644 pt-BR/assets/js/19b14462.1ef0ded7.js delete mode 100644 pt-BR/assets/js/19b14462.ffc50926.js create mode 100644 pt-BR/assets/js/31fd616d.cfc7c78e.js delete mode 100644 pt-BR/assets/js/31fd616d.d6792d13.js delete mode 100644 pt-BR/assets/js/4a484b02.0b0dd730.js create mode 100644 pt-BR/assets/js/4a484b02.5e12d515.js delete mode 100644 pt-BR/assets/js/6905f42e.284fd962.js create mode 100644 pt-BR/assets/js/6905f42e.e4f764bf.js delete mode 100644 pt-BR/assets/js/8420b8df.3538c872.js create mode 100644 pt-BR/assets/js/8420b8df.dd8684c7.js delete mode 100644 pt-BR/assets/js/935f2afb.3a9c3e69.js create mode 100644 pt-BR/assets/js/935f2afb.c53862c1.js create mode 100644 pt-BR/assets/js/ad872c75.5776bf79.js delete mode 100644 pt-BR/assets/js/ad872c75.7e629dc5.js create mode 100644 pt-BR/assets/js/b9256968.5f33e496.js delete mode 100644 pt-BR/assets/js/b9256968.a17fa1ee.js rename pt-BR/assets/js/{d23ae857.0e7597ef.js => d23ae857.b36c887e.js} (53%) create mode 100644 pt-BR/assets/js/e8ea0ffb.f8d1075f.js delete mode 100644 pt-BR/assets/js/e8ea0ffb.fcf3a6b5.js delete mode 100644 pt-BR/assets/js/ee2b4fdf.11b95856.js create mode 100644 pt-BR/assets/js/ee2b4fdf.827f92cd.js create mode 100644 pt-BR/assets/js/f2ae99f3.f0a7970f.js delete mode 100644 pt-BR/assets/js/f2ae99f3.f2bfc858.js create mode 100644 pt-BR/assets/js/fcec3894.0cbe4614.js delete mode 100644 pt-BR/assets/js/fcec3894.f0e483ef.js delete mode 100644 pt-BR/assets/js/runtime~main.7e731106.js create mode 100644 pt-BR/assets/js/runtime~main.911b8743.js rename ru-RU/assets/js/{935f2afb.b0d9b4b1.js => 935f2afb.719cfa4f.js} (65%) delete mode 100644 ru-RU/assets/js/a9ffebd3.720c7079.js create mode 100644 ru-RU/assets/js/a9ffebd3.8774ce07.js rename ru-RU/assets/js/{runtime~main.8374a859.js => runtime~main.af0f7f13.js} (95%) rename zh-Hans/assets/js/{1fd60438.121b35ab.js => 1fd60438.9968be29.js} (95%) rename zh-Hans/assets/js/{runtime~main.ec265e34.js => runtime~main.d1160671.js} (98%) diff --git a/pt-BR/404.html b/pt-BR/404.html index e6a672b8..f1979428 100644 --- a/pt-BR/404.html +++ b/pt-BR/404.html @@ -10,13 +10,13 @@ - +
Pular para o conteúdo principal

Página não encontrada

Não foi possível encontrar o que você está procurando.

Entre em contato com o proprietário do site que lhe trouxe para cá e lhe informe que o link está quebrado.

- + \ No newline at end of file diff --git a/pt-BR/api/index.html b/pt-BR/api/index.html index 66076cc4..3e61daac 100644 --- a/pt-BR/api/index.html +++ b/pt-BR/api/index.html @@ -10,13 +10,13 @@ - +
-
Pular para o conteúdo principal

Referência da API

CLI

O comando "task" tem a seguinte sintaxe:

task [--flags] [tasks...] [-- CLI_ARGS...]
dica

Se -- é informado, todos os argumentos remanescentes serão atribuídos a uma variável especial chamada CLI_ARGS

AbreviaçãoModificadorTipoPredefiniçãoDescrição
-c--colorbooltrueSaída colorida. Habilitado por padrão. Defina o modificador como false ou use NO_COLOR=1 para desativar.
-C--concurrencyint0Limitar número de tarefas a serem executadas simultaneamente. Zero significa ilimitado.
-d--dirstringPasta atualDefine a pasta de execução.
-n--dryboolfalseCompila e imprime as tarefas na ordem em que elas seriam executadas, sem executá-las.
-x--exit-codeboolfalseFaz com que o código de saída do comando sendo executado seja repassado pelo Task.
-f--forceboolfalseForça a execução mesmo quando a tarefa está atualizada.
-g--globalboolfalseExecuta o Taskfile global, de $HOME/Taskfile.{yml,yaml}.
-h--helpboolfalseMostra a ajuda do Task.
-i--initboolfalseCria um novo Taskfile.yml na pasta atual.
-I--intervalstring5sDefine um intervalo de tempo diferente ao usar --watch, o padrão sendo 5 segundos. Este valor deve ser um Go Duration válido.
-l--listboolfalseLista as tarefas com descrição do Taskfile atual.
-a--list-allboolfalseLista todas as tarefas, com ou sem descrição.
--sortstringdefaultAltera a ordem das tarefas quando listadas.
--jsonboolfalseImprime a saída em JSON.
-o--outputstringO padrão é o que está definido no Taskfile, ou então intervealed.Configura o estilo de saída: [interleaved/group/prefixed].
--output-group-beginstringFormato de mensagem a imprimir antes da saída agrupada de uma tarefa.
--output-group-endstringFormato de mensagem a imprimir depois da saída agrupada de uma tarefa.
--output-group-error-onlyboolfalseOculta saída dos comandos que terminarem sem erro.
-p--parallelboolfalseExecuta as tarefas fornecidas na linha de comando em paralelo.
-s--silentboolfalseDesabilita impressão.
--statusboolfalseSai com código de saída diferente de zero se alguma das tarefas especificadas não estiver atualizada.
--summaryboolfalseMostrar resumo sobre uma tarefa.
-t--taskfilestringTaskfile.yml ou Taskfile.yaml
-v--verboseboolfalseHabilita modo verboso.
--versionboolfalseMostrar versão do Task.
-w--watchboolfalseHabilita o monitoramento de tarefas.

Códigos de saída

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:

  • 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ódigoDescrição
0Sucesso
1Um erro desconhecido ocorreu
100Nenhum Arquivo foi encontrado
101Um arquivo Taskfile já existe ao tentar inicializar um
102O arquivo Taskfile é inválido ou não pode ser analisado
200A tarefa especificada não pôde ser encontrada
201Ocorreu um erro ao executar um comando dentro de uma tarefa
202O usuário tentou invocar uma tarefa que é interna
203Há várias tarefas com o mesmo nome ou apelido
204Uma tarefa foi chamada muitas vezes

Esses códigos também podem ser encontrados no repositório em 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.

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:

{
"tasks": [
{
"name": "",
"desc": "",
"summary": "",
"up_to_date": false,
"location": {
"line": 54,
"column": 3,
"taskfile": "/path/to/Taskfile.yml"
}
}
// ...
],
"location": "/path/to/Taskfile.yml"
}

Variáveis Especiais

There are some special variables that is available on the templating system:

VarDescription
CLI_ARGSContain all extra arguments passed after -- when calling Task through the CLI.
TASKThe name of the current task.
ROOT_DIRThe absolute path of the root Taskfile.
TASKFILE_DIRThe absolute path of the included Taskfile.
USER_WORKING_DIRThe absolute path of the directory task was called from.
CHECKSUMThe checksum of the files listed in sources. Only available within the status prop and if method is set to checksum.
TIMESTAMPThe date object of the greatest timestamp of the files listes in sources. Only available within the status prop and if method is set to timestamp.
TASK_VERSIONThe current version of task.

ENV

Some environment variables can be overriden to adjust Task behavior.

ENVDefaultDescription
TASK_TEMP_DIR.taskLocation of the temp dir. Can relative to the project like tmp/task or absolute like /tmp/.task or ~/.task.
TASK_COLOR_RESET0Color used for white.
TASK_COLOR_BLUE34Color used for blue.
TASK_COLOR_GREEN32Color used for green.
TASK_COLOR_CYAN36Color used for cyan.
TASK_COLOR_YELLOW33Color used for yellow.
TASK_COLOR_MAGENTA35Color used for magenta.
TASK_COLOR_RED31Color used for red.
FORCE_COLORForce color output usage.

Taskfile Schema

AttributeTypeDefaultDescription
versionstringVersion of the Taskfile. The current version is 3.
outputstringinterleavedOutput mode. Available options: interleaved, group and prefixed.
methodstringchecksumDefault method in this Taskfile. Can be overriden in a task by task basis. Available options: checksum, timestamp and none.
includesmap[string]IncludeAdditional Taskfiles to be included.
varsmap[string]VariableA set of global variables.
envmap[string]VariableA set of global environment variables.
tasksmap[string]TaskA set of task definitions.
silentboolfalseDefault 'silent' options for this Taskfile. If false, can be overidden with true in a task by task basis.
dotenv[]stringA list of .env file paths to be parsed.
runstringalwaysDefault 'run' option for this Taskfile. Available options: always, once and when_changed.
intervalstring5sSets a different watch interval when using --watch, the default being 5 seconds. This string should be a valid Go Duration.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.

Include

AttributeTypeDefaultDescription
taskfilestringThe path for the Taskfile or directory to be included. If a directory, Task will look for files named Taskfile.yml or Taskfile.yaml inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile.
dirstringThe parent Taskfile directoryThe working directory of the included tasks when run.
optionalboolfalseIf true, no errors will be thrown if the specified file does not exist.
internalboolfalseStops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with --list.
aliases[]stringAlternative names for the namespace of the included Taskfile.
varsmap[string]VariableA set of variables to apply to the included Taskfile.
info

Informing only a string like below is equivalent to setting that value to the taskfile attribute.

includes:
foo: ./path

Variable

AttributeTypeDefaultDescription
itselfstringA static value that will be set to the variable.
shstringA shell command. The output (STDOUT) will be assigned to the variable.
info

Static and dynamic variables have different syntaxes, like below:

vars:
STATIC: static
DYNAMIC:
sh: echo "dynamic"

Task

AttributeTypeDefaultDescription
cmds[]CommandA list of shell commands to be executed.
deps[]DependencyA list of dependencies of this task. Tasks defined here will run in parallel before this task.
labelstringOverrides the name of the task in the output when a task is run. Supports variables.
descstringA short description of the task. This is displayed when calling task --list.
summarystringA longer description of the task. This is displayed when calling task --summary [task].
aliases[]stringA list of alternative names by which the task can be called.
sources[]stringA list of sources to check before running this task. Relevant for checksum and timestamp methods. Can be file paths or star globs.
generates[]stringA list of files meant to be generated by this task. Relevant for timestamp method. Can be file paths or star globs.
status[]stringA list of commands to check if this task should run. The task is skipped otherwise. This overrides method, sources and generates.
preconditions[]PreconditionA list of commands to check if this task should run. If a condition is not met, the task will error.
dirstringThe directory in which this task should run. Defaults to the current working directory.
varsmap[string]VariableA set of variables that can be used in the task.
envmap[string]VariableA set of environment variables that will be made available to shell commands.
dotenv[]stringA list of .env file paths to be parsed.
silentboolfalseHides task name and command from output. The command's output will still be redirected to STDOUT and STDERR. When combined with the --list flag, task descriptions will be hidden.
interactiveboolfalseTells task that the command is interactive.
internalboolfalseStops a task from being callable on the command line. It will also be omitted from the output when used with --list.
methodstringchecksumDefines which method is used to check the task is up-to-date. timestamp will compare the timestamp of the sources and generates files. checksum will check the checksum (You probably want to ignore the .task folder in your .gitignore file). none skips any validation and always run the task.
prefixstringDefines a string to prefix the output of tasks running in parallel. Only used when the output mode is prefixed.
ignore_errorboolfalseContinue execution if errors happen while executing commands.
runstringThe one declared globally in the Taskfile or alwaysSpecifies whether the task should run again or not if called more than once. Available options: always, once and when_changed.
platforms[]stringAll platformsSpecifies which platforms the task should be run on. Valid GOOS and GOARCH values allowed. Task will be skipped otherwise.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.
info

These alternative syntaxes are available. They will set the given values to cmds and everything else will be set to their default values:

tasks:
foo: echo "foo"

foobar:
- echo "foo"
- echo "bar"

baz:
cmd: echo "baz"

Command

AttributeTypeDefaultDescription
cmdstringThe shell command to be executed.
silentboolfalseSkips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected.
taskstringSet this to trigger execution of another task instead of running a command. This cannot be set together with cmd.
varsmap[string]VariableOptional additional variables to be passed to the referenced task. Only relevant when setting task instead of cmd.
ignore_errorboolfalseContinue execution if errors happen while executing the command.
deferstringAlternative 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[]stringAll platformsSpecifies which platforms the command should be run on. Valid GOOS and GOARCH values allowed. Command will be skipped otherwise.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.
info

If given as a a string, the value will be assigned to cmd:

tasks:
foo:
cmds:
- echo "foo"
- echo "bar"

Dependency

AttributeTypeDefaultDescription
taskstringThe task to be execute as a dependency.
varsmap[string]VariableOptional additional variables to be passed to this task.
silentboolfalseHides task name and command from output. The command's output will still be redirected to STDOUT and STDERR.
dica

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):

tasks:
foo:
deps: [foo, bar]

Precondition

AttributeTypeDefaultDescription
shstringCommand to be executed. If a non-zero exit code is returned, the task errors without executing its commands.
msgstringOptional message to print if the precondition isn't met.
dica

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:

tasks:
foo:
precondition: test -f Taskfile.yml
- +
Pular para o conteúdo principal

Referência da API

CLI

O comando "task" tem a seguinte sintaxe:

task [--flags] [tasks...] [-- CLI_ARGS...]
dica

Se -- é informado, todos os argumentos remanescentes serão atribuídos a uma variável especial chamada CLI_ARGS

AbreviaçãoModificadorTipoPredefiniçãoDescrição
-c--colorbooltrueSaída colorida. Habilitado por padrão. Defina o modificador como false ou use NO_COLOR=1 para desativar.
-C--concurrencyint0Limitar número de tarefas a serem executadas simultaneamente. Zero significa ilimitado.
-d--dirstringPasta atualDefine a pasta de execução.
-n--dryboolfalseCompila e imprime as tarefas na ordem em que elas seriam executadas, sem executá-las.
-x--exit-codeboolfalseFaz com que o código de saída do comando sendo executado seja repassado pelo Task.
-f--forceboolfalseForça a execução mesmo quando a tarefa está atualizada.
-g--globalboolfalseExecuta o Taskfile global, de $HOME/Taskfile.{yml,yaml}.
-h--helpboolfalseMostra a ajuda do Task.
-i--initboolfalseCria um novo Taskfile.yml na pasta atual.
-I--intervalstring5sDefine um intervalo de tempo diferente ao usar --watch, o padrão sendo 5 segundos. Este valor deve ser um Go Duration válido.
-l--listboolfalseLista as tarefas com descrição do Taskfile atual.
-a--list-allboolfalseLista todas as tarefas, com ou sem descrição.
--sortstringdefaultAltera a ordem das tarefas quando listadas.
--jsonboolfalseImprime a saída em JSON.
-o--outputstringO padrão é o que está definido no Taskfile, ou então intervealed.Configura o estilo de saída: [interleaved/group/prefixed].
--output-group-beginstringFormato de mensagem a imprimir antes da saída agrupada de uma tarefa.
--output-group-endstringFormato de mensagem a imprimir depois da saída agrupada de uma tarefa.
--output-group-error-onlyboolfalseOculta saída dos comandos que terminarem sem erro.
-p--parallelboolfalseExecuta as tarefas fornecidas na linha de comando em paralelo.
-s--silentboolfalseDesabilita impressão.
--statusboolfalseSai com código de saída diferente de zero se alguma das tarefas especificadas não estiver atualizada.
--summaryboolfalseMostrar resumo sobre uma tarefa.
-t--taskfilestringTaskfile.yml ou Taskfile.yaml
-v--verboseboolfalseHabilita modo verboso.
--versionboolfalseMostrar versão do Task.
-w--watchboolfalseHabilita o monitoramento de tarefas.

Códigos de saída

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:

  • 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ódigoDescrição
0Sucesso
1Um erro desconhecido ocorreu
100Nenhum Arquivo foi encontrado
101Um arquivo Taskfile já existe ao tentar inicializar um
102O arquivo Taskfile é inválido ou não pode ser analisado
200A tarefa especificada não pôde ser encontrada
201Ocorreu um erro ao executar um comando dentro de uma tarefa
202O usuário tentou invocar uma tarefa que é interna
203Há várias tarefas com o mesmo nome ou apelido
204Uma tarefa foi chamada muitas vezes

Esses códigos também podem ser encontrados no repositório em 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.

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:

{
"tasks": [
{
"name": "",
"desc": "",
"summary": "",
"up_to_date": false,
"location": {
"line": 54,
"column": 3,
"taskfile": "/path/to/Taskfile.yml"
}
}
// ...
],
"location": "/path/to/Taskfile.yml"
}

Variáveis Especiais

There are some special variables that is available on the templating system:

VarDescription
CLI_ARGSContain all extra arguments passed after -- when calling Task through the CLI.
TASKThe name of the current task.
ROOT_DIRThe absolute path of the root Taskfile.
TASKFILE_DIRThe absolute path of the included Taskfile.
USER_WORKING_DIRThe absolute path of the directory task was called from.
CHECKSUMThe checksum of the files listed in sources. Only available within the status prop and if method is set to checksum.
TIMESTAMPThe date object of the greatest timestamp of the files listes in sources. Only available within the status prop and if method is set to timestamp.
TASK_VERSIONThe current version of task.

ENV

Some environment variables can be overriden to adjust Task behavior.

ENVDefaultDescription
TASK_TEMP_DIR.taskLocation of the temp dir. Can relative to the project like tmp/task or absolute like /tmp/.task or ~/.task.
TASK_COLOR_RESET0Color used for white.
TASK_COLOR_BLUE34Color used for blue.
TASK_COLOR_GREEN32Color used for green.
TASK_COLOR_CYAN36Color used for cyan.
TASK_COLOR_YELLOW33Color used for yellow.
TASK_COLOR_MAGENTA35Color used for magenta.
TASK_COLOR_RED31Color used for red.
FORCE_COLORForce color output usage.

Taskfile Schema

AttributeTypeDefaultDescription
versionstringVersion of the Taskfile. The current version is 3.
outputstringinterleavedOutput mode. Available options: interleaved, group and prefixed.
methodstringchecksumDefault method in this Taskfile. Can be overriden in a task by task basis. Available options: checksum, timestamp and none.
includesmap[string]IncludeAdditional Taskfiles to be included.
varsmap[string]VariableA set of global variables.
envmap[string]VariableA set of global environment variables.
tasksmap[string]TaskA set of task definitions.
silentboolfalseDefault 'silent' options for this Taskfile. If false, can be overidden with true in a task by task basis.
dotenv[]stringA list of .env file paths to be parsed.
runstringalwaysDefault 'run' option for this Taskfile. Available options: always, once and when_changed.
intervalstring5sSets a different watch interval when using --watch, the default being 5 seconds. This string should be a valid Go Duration.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.

Include

AttributeTypeDefaultDescription
taskfilestringThe path for the Taskfile or directory to be included. If a directory, Task will look for files named Taskfile.yml or Taskfile.yaml inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile.
dirstringThe parent Taskfile directoryThe working directory of the included tasks when run.
optionalboolfalseIf true, no errors will be thrown if the specified file does not exist.
internalboolfalseStops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with --list.
aliases[]stringAlternative names for the namespace of the included Taskfile.
varsmap[string]VariableA set of variables to apply to the included Taskfile.
info

Informing only a string like below is equivalent to setting that value to the taskfile attribute.

includes:
foo: ./path

Variable

AttributeTypeDefaultDescription
itselfstringA static value that will be set to the variable.
shstringA shell command. The output (STDOUT) will be assigned to the variable.
info

Static and dynamic variables have different syntaxes, like below:

vars:
STATIC: static
DYNAMIC:
sh: echo "dynamic"

Task

AttributeTypeDefaultDescription
cmds[]CommandA list of shell commands to be executed.
deps[]DependencyA list of dependencies of this task. Tasks defined here will run in parallel before this task.
labelstringOverrides the name of the task in the output when a task is run. Supports variables.
descstringA short description of the task. This is displayed when calling task --list.
summarystringA longer description of the task. This is displayed when calling task --summary [task].
aliases[]stringA list of alternative names by which the task can be called.
sources[]stringA list of sources to check before running this task. Relevant for checksum and timestamp methods. Can be file paths or star globs.
generates[]stringA list of files meant to be generated by this task. Relevant for timestamp method. Can be file paths or star globs.
status[]stringA list of commands to check if this task should run. The task is skipped otherwise. This overrides method, sources and generates.
preconditions[]PreconditionA list of commands to check if this task should run. If a condition is not met, the task will error.
dirstringThe directory in which this task should run. Defaults to the current working directory.
varsmap[string]VariableA set of variables that can be used in the task.
envmap[string]VariableA set of environment variables that will be made available to shell commands.
dotenv[]stringA list of .env file paths to be parsed.
silentboolfalseHides task name and command from output. The command's output will still be redirected to STDOUT and STDERR. When combined with the --list flag, task descriptions will be hidden.
interactiveboolfalseTells task that the command is interactive.
internalboolfalseStops a task from being callable on the command line. It will also be omitted from the output when used with --list.
methodstringchecksumDefines which method is used to check the task is up-to-date. timestamp will compare the timestamp of the sources and generates files. checksum will check the checksum (You probably want to ignore the .task folder in your .gitignore file). none skips any validation and always run the task.
prefixstringDefines a string to prefix the output of tasks running in parallel. Only used when the output mode is prefixed.
ignore_errorboolfalseContinue execution if errors happen while executing commands.
runstringThe one declared globally in the Taskfile or alwaysSpecifies whether the task should run again or not if called more than once. Available options: always, once and when_changed.
platforms[]stringAll platformsSpecifies which platforms the task should be run on. Valid GOOS and GOARCH values allowed. Task will be skipped otherwise.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.
info

These alternative syntaxes are available. They will set the given values to cmds and everything else will be set to their default values:

tasks:
foo: echo "foo"

foobar:
- echo "foo"
- echo "bar"

baz:
cmd: echo "baz"

Command

AttributeTypeDefaultDescription
cmdstringThe shell command to be executed.
silentboolfalseSkips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected.
taskstringSet this to trigger execution of another task instead of running a command. This cannot be set together with cmd.
varsmap[string]VariableOptional additional variables to be passed to the referenced task. Only relevant when setting task instead of cmd.
ignore_errorboolfalseContinue execution if errors happen while executing the command.
deferstringAlternative 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[]stringAll platformsSpecifies which platforms the command should be run on. Valid GOOS and GOARCH values allowed. Command will be skipped otherwise.
set[]stringSpecify options for the set builtin.
shopt[]stringSpecify option for the shopt builtin.
info

If given as a a string, the value will be assigned to cmd:

tasks:
foo:
cmds:
- echo "foo"
- echo "bar"

Dependency

AttributeTypeDefaultDescription
taskstringThe task to be execute as a dependency.
varsmap[string]VariableOptional additional variables to be passed to this task.
silentboolfalseHides task name and command from output. The command's output will still be redirected to STDOUT and STDERR.
dica

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):

tasks:
foo:
deps: [foo, bar]

Precondition

AttributeTypeDefaultDescription
shstringCommand to be executed. If a non-zero exit code is returned, the task errors without executing its commands.
msgstringOptional message to print if the precondition isn't met.
dica

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:

tasks:
foo:
precondition: test -f Taskfile.yml
+ \ No newline at end of file diff --git a/pt-BR/assets/js/19a1e173.f78a02ec.js b/pt-BR/assets/js/19a1e173.f78a02ec.js new file mode 100644 index 00000000..72a78665 --- /dev/null +++ b/pt-BR/assets/js/19a1e173.f78a02ec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[19],{3905:function(t,e,a){a.d(e,{Zo:function(){return h},kt:function(){return d}});var i=a(7294);function s(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function n(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function l(t){for(var e=1;e=0||(s[a]=t[a]);return s}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}var o=i.createContext({}),k=function(t){var e=i.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},h=function(t){var e=k(t.components);return i.createElement(o.Provider,{value:e},t.children)},m="mdxType",p={inlineCode:"code",wrapper:function(t){var e=t.children;return i.createElement(i.Fragment,{},e)}},u=i.forwardRef((function(t,e){var a=t.components,s=t.mdxType,n=t.originalType,o=t.parentName,h=r(t,["components","mdxType","originalType","parentName"]),m=k(a),u=s,d=m["".concat(o,".").concat(u)]||m[u]||p[u]||n;return a?i.createElement(d,l(l({ref:e},h),{},{components:a})):i.createElement(d,l({ref:e},h))}));function d(t,e){var a=arguments,s=e&&e.mdxType;if("string"==typeof t||s){var n=a.length,l=new Array(n);l[0]=u;var r={};for(var o in e)hasOwnProperty.call(e,o)&&(r[o]=e[o]);r.originalType=t,r[m]="string"==typeof t?t:s,l[1]=r;for(var k=2;k=0||(s[a]=t[a]);return s}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(s[a]=t[a])}return s}var o=i.createContext({}),k=function(t){var e=i.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},h=function(t){var e=k(t.components);return i.createElement(o.Provider,{value:e},t.children)},m="mdxType",p={inlineCode:"code",wrapper:function(t){var e=t.children;return i.createElement(i.Fragment,{},e)}},u=i.forwardRef((function(t,e){var a=t.components,s=t.mdxType,n=t.originalType,o=t.parentName,h=r(t,["components","mdxType","originalType","parentName"]),m=k(a),u=s,d=m["".concat(o,".").concat(u)]||m[u]||p[u]||n;return a?i.createElement(d,l(l({ref:e},h),{},{components:a})):i.createElement(d,l({ref:e},h))}));function d(t,e){var a=arguments,s=e&&e.mdxType;if("string"==typeof t||s){var n=a.length,l=new Array(n);l[0]=u;var r={};for(var o in e)hasOwnProperty.call(e,o)&&(r[o]=e[o]);r.originalType=t,r[m]="string"==typeof t?t:s,l[1]=r;for(var k=2;k=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=a.createContext({}),l=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},c="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,u=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=l(n),h=o,m=c["".concat(u,".").concat(h)]||c[h]||p[h]||i;return n?a.createElement(m,r(r({ref:t},d),{},{components:n})):a.createElement(m,r({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=h;var s={};for(var u in t)hasOwnProperty.call(t,u)&&(s[u]=t[u]);s.originalType=e,s[c]="string"==typeof e?e:o,r[1]=s;for(var l=2;l "),"."),(0,o.kt)("p",null,"To run Task for Visual Studio Code, you can open the project in VSCode and hit F5 (or whatever you debug keybind is set to). This will open a new VSCode window with the extension running. Debugging this way is recommended as it will allow you to set breakpoints and step through the code. Otherwise, you can run ",(0,o.kt)("inlineCode",{parentName:"p"},"task package")," which will generate a ",(0,o.kt)("inlineCode",{parentName:"p"},".vsix")," file that can be used to manually install the extension."),(0,o.kt)("h3",{id:"updating-documentation"},"Updating documentation"),(0,o.kt)("p",null,"Task uses ",(0,o.kt)("a",{parentName:"p",href:"https://docusaurus.io"},"Docusaurus")," to host a documentation server. The code for this is located in the core Task repository. This can be setup and run locally by using ",(0,o.kt)("inlineCode",{parentName:"p"},"task docs")," (requires ",(0,o.kt)("inlineCode",{parentName:"p"},"nodejs")," & ",(0,o.kt)("inlineCode",{parentName:"p"},"yarn"),"). All content is written in Markdown and is located in the ",(0,o.kt)("inlineCode",{parentName:"p"},"docs/docs")," directory. All Markdown documents should have an 80 character line wrap limit (enforced by Prettier)."),(0,o.kt)("p",null,"When making a change, consider whether a change to the ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/usage/"},"Usage Guide")," 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 ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/styleguide/"},"Taskfile Styleguide"),"."),(0,o.kt)("p",null,"If you added a new field, command or flag, ensure that you add it to the ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/api/"},"API Reference"),". New fields also need to be added to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/main/docs/static/schema.json"},"JSON Schema"),". The descriptions for fields in the API reference and the schema should match."),(0,o.kt)("h3",{id:"writing-tests"},"Writing tests"),(0,o.kt)("p",null,"A lot of Task's tests are held in the ",(0,o.kt)("inlineCode",{parentName:"p"},"task_test.go")," file in the project root and this is where you'll most likely want to add new ones too. Most of these tests also have a subdirectory in the ",(0,o.kt)("inlineCode",{parentName:"p"},"testdata")," directory where any Taskfiles/data required to run the tests are stored."),(0,o.kt)("p",null,"When making a changes, consider whether new tests are required. These tests should ensure that the functionality you are adding will continue to work in the future. Existing tests may also need updating if you have changed Task's behavior."),(0,o.kt)("p",null,"You may also consider adding unit tests for any new functions you have added. The unit tests should follow the Go convention of being location in a file named ",(0,o.kt)("inlineCode",{parentName:"p"},"*_test.go")," in the same package as the code being tested."),(0,o.kt)("h2",{id:"3-committing-your-code"},"3. Committing your code"),(0,o.kt)("p",null,"Try to write meaningful commit messages and avoid having too many commits on the PR. Most PRs should likely have a single commit (although for bigger PRs it may be reasonable to split it in a few). Git squash and rebase is your friend!"),(0,o.kt)("p",null,"If you're not sure how to format your commit message, check out ",(0,o.kt)("a",{parentName:"p",href:"https://www.conventionalcommits.org"},"Conventional Commits"),". This style is not enforced, but it is a good way to make your commit messages more readable and consistent."),(0,o.kt)("h2",{id:"4-submitting-a-pr"},"4. Submitting a PR"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Describe your changes")," - Ensure that you provide a comprehensive description of your changes."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Issue/PR links")," - Link any previous work such as related issues or PRs. Please describe how your changes differ to/extend this work."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Examples")," - Add any examples or screenshots that you think are useful to demonstrate the effect of your changes."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Draft PRs")," - If your changes are incomplete, but you would like to discuss them, open the PR as a draft and add a comment to start a discussion. Using comments rather than the PR description allows the description to be updated later while preserving any discussions.")),(0,o.kt)("h2",{id:"faq"},"FAQ"),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"I want to contribute, where do I start?")),(0,o.kt)("p",null,"Take a look at the list of ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/issues"},"open issues for Task")," or ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/vscode-task/issues"},"Task for Visual Studio Code"),". We have a ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22"},"good first issue")," label for simpler issues that are ideal for first time contributions."),(0,o.kt)("p",null,"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 ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/community/"},"community projects"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"I'm stuck, where can I get help?")),(0,o.kt)("p",null,"If you have questions, feel free to ask them in the ",(0,o.kt)("inlineCode",{parentName:"p"},"#help")," forum channel on our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/6TY36E39UK"},"Discord server")," or open a ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/discussions"},"Discussion")," on GitHub."),(0,o.kt)("hr",null))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/19b14462.ffc50926.js b/pt-BR/assets/js/19b14462.ffc50926.js deleted file mode 100644 index 202f91e5..00000000 --- a/pt-BR/assets/js/19b14462.ffc50926.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[418],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return h}});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=a.createContext({}),l=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,u=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,h=d["".concat(u,".").concat(m)]||d[m]||p[m]||i;return n?a.createElement(h,r(r({ref:t},c),{},{components:n})):a.createElement(h,r({ref:t},c))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=m;var s={};for(var u in t)hasOwnProperty.call(t,u)&&(s[u]=t[u]);s.originalType=e,s[d]="string"==typeof e?e:o,r[1]=s;for(var l=2;l "),"."),(0,o.kt)("p",null,"To run Task for Visual Studio Code, you can open the project in VSCode and hit F5 (or whatever you debug keybind is set to). This will open a new VSCode window with the extension running. Debugging this way is recommended as it will allow you to set breakpoints and step through the code. Otherwise, you can run ",(0,o.kt)("inlineCode",{parentName:"p"},"task package")," which will generate a ",(0,o.kt)("inlineCode",{parentName:"p"},".vsix")," file that can be used to manually install the extension."),(0,o.kt)("h3",{id:"updating-documentation"},"Updating documentation"),(0,o.kt)("p",null,"Task uses ",(0,o.kt)("a",{parentName:"p",href:"https://docusaurus.io"},"Docusaurus")," to host a documentation server. The code for this is located in the core Task repository. This can be setup and run locally by using ",(0,o.kt)("inlineCode",{parentName:"p"},"task docs")," (requires ",(0,o.kt)("inlineCode",{parentName:"p"},"nodejs")," & ",(0,o.kt)("inlineCode",{parentName:"p"},"yarn"),"). All content is written in Markdown and is located in the ",(0,o.kt)("inlineCode",{parentName:"p"},"docs/docs")," directory. All Markdown documents should have an 80 character line wrap limit (enforced by Prettier)."),(0,o.kt)("p",null,"When making a change, consider whether a change to the ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/usage/"},"Usage Guide")," 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 ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/styleguide/"},"Taskfile Styleguide"),"."),(0,o.kt)("p",null,"If you added a new field, command or flag, ensure that you add it to the ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/api/"},"API Reference"),". New fields also need to be added to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/main/docs/static/schema.json"},"JSON Schema"),". The descriptions for fields in the API reference and the schema should match."),(0,o.kt)("h3",{id:"writing-tests"},"Writing tests"),(0,o.kt)("p",null,"A lot of Task's tests are held in the ",(0,o.kt)("inlineCode",{parentName:"p"},"task_test.go")," file in the project root and this is where you'll most likely want to add new ones too. Most of these tests also have a subdirectory in the ",(0,o.kt)("inlineCode",{parentName:"p"},"testdata")," directory where any Taskfiles/data required to run the tests are stored."),(0,o.kt)("p",null,"When making a changes, consider whether new tests are required. These tests should ensure that the functionality you are adding will continue to work in the future. Existing tests may also need updating if you have changed Task's behavior."),(0,o.kt)("p",null,"You may also consider adding unit tests for any new functions you have added. The unit tests should follow the Go convention of being location in a file named ",(0,o.kt)("inlineCode",{parentName:"p"},"*_test.go")," in the same package as the code being tested."),(0,o.kt)("h2",{id:"3-committing-your-code"},"3. Committing your code"),(0,o.kt)("p",null,"Try to write meaningful commit messages and avoid having too many commits on the PR. Most PRs should likely have a single commit (although for bigger PRs it may be reasonable to split it in a few). Git squash and rebase is your friend!"),(0,o.kt)("p",null,"If you're not sure how to format your commit message, check out ",(0,o.kt)("a",{parentName:"p",href:"https://www.conventionalcommits.org"},"Conventional Commits"),". This style is not enforced, but it is a good way to make your commit messages more readable and consistent."),(0,o.kt)("h2",{id:"4-submitting-a-pr"},"4. Submitting a PR"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Describe your changes")," - Ensure that you provide a comprehensive description of your changes."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Issue/PR links")," - Link any previous work such as related issues or PRs. Please describe how your changes differ to/extend this work."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Examples")," - Add any examples or screenshots that you think are useful to demonstrate the effect of your changes."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Draft PRs")," - If your changes are incomplete, but you would like to discuss them, open the PR as a draft and add a comment to start a discussion. Using comments rather than the PR description allows the description to be updated later while preserving any discussions.")),(0,o.kt)("h2",{id:"faq"},"FAQ"),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"I want to contribute, where do I start?")),(0,o.kt)("p",null,"Take a look at the list of ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/issues"},"open issues for Task")," or ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/vscode-task/issues"},"Task for Visual Studio Code"),". We have a ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22"},"good first issue")," label for simpler issues that are ideal for first time contributions."),(0,o.kt)("p",null,"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 ",(0,o.kt)("a",{parentName:"p",href:"/pt-BR/community/"},"community projects"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"I'm stuck, where can I get help?")),(0,o.kt)("p",null,"If you have questions, feel free to ask them in the ",(0,o.kt)("inlineCode",{parentName:"p"},"#help")," forum channel on our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/6TY36E39UK"},"Discord server")," or open a ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/discussions"},"Discussion")," on GitHub."),(0,o.kt)("hr",null))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/31fd616d.cfc7c78e.js b/pt-BR/assets/js/31fd616d.cfc7c78e.js new file mode 100644 index 00000000..c76b80f6 --- /dev/null +++ b/pt-BR/assets/js/31fd616d.cfc7c78e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[791],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return h}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=r,h=u["".concat(l,".").concat(f)]||u[f]||m[f]||o;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:r,i[1]=s;for(var p=2;p=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=r,h=u["".concat(l,".").concat(f)]||u[f]||m[f]||o;return n?a.createElement(h,i(i({ref:t},c),{},{components:n})):a.createElement(h,i({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:r,i[1]=s;for(var p=2;p=0||(u[D]=M[D]);return u}(M,N);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(M);for(j=0;j=0||Object.prototype.propertyIsEnumerable.call(M,D)&&(u[D]=M[D])}return u}var z=j.createContext({}),g=function(M){var N=j.useContext(z),D=N;return M&&(D="function"==typeof M?M(N):T(T({},N),M)),D},i=function(M){var N=g(M.components);return j.createElement(z.Provider,{value:N},M.children)},a="mdxType",t={inlineCode:"code",wrapper:function(M){var N=M.children;return j.createElement(j.Fragment,{},N)}},A=j.forwardRef((function(M,N){var D=M.components,u=M.mdxType,e=M.originalType,z=M.parentName,i=I(M,["components","mdxType","originalType","parentName"]),a=g(D),A=u,O=a["".concat(z,".").concat(A)]||a[A]||t[A]||e;return D?j.createElement(O,T(T({ref:N},i),{},{components:D})):j.createElement(O,T({ref:N},i))}));function O(M,N){var D=arguments,u=N&&N.mdxType;if("string"==typeof M||u){var e=D.length,T=new Array(e);T[0]=A;var I={};for(var z in N)hasOwnProperty.call(N,z)&&(I[z]=N[z]);I.originalType=M,I[a]="string"==typeof M?M:u,T[1]=I;for(var g=2;g=0||(u[D]=M[D]);return u}(M,N);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(M);for(j=0;j=0||Object.prototype.propertyIsEnumerable.call(M,D)&&(u[D]=M[D])}return u}var z=j.createContext({}),g=function(M){var N=j.useContext(z),D=N;return M&&(D="function"==typeof M?M(N):e(e({},N),M)),D},i=function(M){var N=g(M.components);return j.createElement(z.Provider,{value:N},M.children)},a="mdxType",t={inlineCode:"code",wrapper:function(M){var N=M.children;return j.createElement(j.Fragment,{},N)}},A=j.forwardRef((function(M,N){var D=M.components,u=M.mdxType,T=M.originalType,z=M.parentName,i=I(M,["components","mdxType","originalType","parentName"]),a=g(D),A=u,O=a["".concat(z,".").concat(A)]||a[A]||t[A]||T;return D?j.createElement(O,e(e({ref:N},i),{},{components:D})):j.createElement(O,e({ref:N},i))}));function O(M,N){var D=arguments,u=N&&N.mdxType;if("string"==typeof M||u){var T=D.length,e=new Array(T);e[0]=A;var I={};for(var z in N)hasOwnProperty.call(N,z)&&(I[z]=N[z]);I.originalType=M,I[a]="string"==typeof M?M:u,e[1]=I;for(var g=2;g=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},k=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(t),k=r,m=c["".concat(s,".").concat(k)]||c[k]||d[k]||l;return t?a.createElement(m,i(i({ref:n},u),{},{components:t})):a.createElement(m,i({ref:n},u))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=k;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[c]="string"==typeof e?e:r,i[1]=o;for(var p=2;p= v3.0.0 anymore.")),(0,r.kt)("p",null,"In the first version of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Taskfile"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"version:")," key was not available, because the tasks was in the root of the YAML document. Like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'echo:\n cmds:\n - echo "Hello, World!"\n')),(0,r.kt)("p",null,"The variable priority order was also different:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Call variables"),(0,r.kt)("li",{parentName:"ol"},"Environment"),(0,r.kt)("li",{parentName:"ol"},"Task variables"),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"Taskvars.yml")," variables")),(0,r.kt)("h2",{id:"version-20"},"Version 2.0"),(0,r.kt)("p",null,"At version 2, we introduced the ",(0,r.kt)("inlineCode",{parentName:"p"},"version:")," key, to allow us to evolve Task with new features without breaking existing Taskfiles. The new syntax is as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\ntasks:\n echo:\n cmds:\n - echo \"Hello, World!\"\n")),(0,r.kt)("p",null,"Version 2 allows you to write global variables directly in the Taskfile, if you don't want to create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Taskvars.yml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nvars:\n GREETING: Hello, World!\n\ntasks:\n greet:\n cmds:\n - echo \"{{.GREETING}}\"\n")),(0,r.kt)("p",null,"The variable priority order changed to the following:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Task variables"),(0,r.kt)("li",{parentName:"ol"},"Call variables"),(0,r.kt)("li",{parentName:"ol"},"Taskfile variables"),(0,r.kt)("li",{parentName:"ol"},"Taskvars file variables"),(0,r.kt)("li",{parentName:"ol"},"Environment variables")),(0,r.kt)("p",null,"A new global option was added to configure the number of variables expansions (which default to 2):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nexpansions: 3\n\nvars:\n FOO: foo\n BAR: bar\n BAZ: baz\n FOOBAR: '{{.FOO}}{{.BAR}}'\n FOOBARBAZ: '{{.FOOBAR}}{{.BAZ}}'\n\ntasks:\n default:\n cmds:\n - echo \"{{.FOOBARBAZ}}\"\n")),(0,r.kt)("h2",{id:"version-21"},"Version 2.1"),(0,r.kt)("p",null,"Version 2.1 includes a global ",(0,r.kt)("inlineCode",{parentName:"p"},"output")," option, to allow having more control over how commands output are printed to the console (see ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#output-syntax"},"documentation")," for more info):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\noutput: prefixed\n\ntasks:\n server:\n cmds:\n - go run main.go\n prefix: server\n")),(0,r.kt)("p",null,"From this version it's also possible to ignore errors of a command or task (check documentation ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#ignore-errors"},"here"),"):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'version: \'2\'\n\ntasks:\n example-1:\n cmds:\n - cmd: exit 1\n ignore_error: true\n - echo "This will be print"\n\n example-2:\n cmds:\n - exit 1\n - echo "This will be print"\n ignore_error: true\n')),(0,r.kt)("h2",{id:"version-22"},"Version 2.2"),(0,r.kt)("p",null,"Version 2.2 comes with a global ",(0,r.kt)("inlineCode",{parentName:"p"},"includes")," options to include other Taskfiles:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nincludes:\n docs: ./documentation # will look for ./documentation/Taskfile.yml\n docker: ./DockerTasks.yml\n")),(0,r.kt)("h2",{id:"version-26"},"Version 2.6"),(0,r.kt)("p",null,"Version 2.6 comes with ",(0,r.kt)("inlineCode",{parentName:"p"},"preconditions")," stanza in tasks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\ntasks:\n upload_environment:\n preconditions:\n - test -f .env\n cmds:\n - aws s3 cp .env s3://myenvironment\n")),(0,r.kt)("p",null,"Please check the ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#including-other-taskfiles"},"documentation")),(0,r.kt)("h2",{id:"version-3"},"Version 3"),(0,r.kt)("p",null,"These are some major changes done on ",(0,r.kt)("inlineCode",{parentName:"p"},"v3"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Task's output will now be colored"),(0,r.kt)("li",{parentName:"ul"},"Added support for ",(0,r.kt)("inlineCode",{parentName:"li"},".env")," like files"),(0,r.kt)("li",{parentName:"ul"},"Added ",(0,r.kt)("inlineCode",{parentName:"li"},"label:")," setting to task so one can override how the task name appear in the logs"),(0,r.kt)("li",{parentName:"ul"},"A global ",(0,r.kt)("inlineCode",{parentName:"li"},"method:")," was added to allow setting the default method, and Task's default changed to ",(0,r.kt)("inlineCode",{parentName:"li"},"checksum")),(0,r.kt)("li",{parentName:"ul"},"Two magic variables were added when using ",(0,r.kt)("inlineCode",{parentName:"li"},"status:"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"CHECKSUM")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"TIMESTAMP")," which contains, respectively, the md5 checksum and greatest modification timestamp of the files listed on ",(0,r.kt)("inlineCode",{parentName:"li"},"sources:")),(0,r.kt)("li",{parentName:"ul"},"Also, the ",(0,r.kt)("inlineCode",{parentName:"li"},"TASK")," variable is always available with the current task name"),(0,r.kt)("li",{parentName:"ul"},"CLI variables are always treated as global variables"),(0,r.kt)("li",{parentName:"ul"},"Added ",(0,r.kt)("inlineCode",{parentName:"li"},"dir:")," option to ",(0,r.kt)("inlineCode",{parentName:"li"},"includes")," to allow choosing on which directory an included Taskfile will run:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"includes:\n docs:\n taskfile: ./docs\n dir: ./docs\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Implemented short task syntax. All below syntaxes are equivalent:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print:\n cmds:\n - echo \"Hello, World!\"\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print:\n - echo \"Hello, World!\"\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print: echo \"Hello, World!\"\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"There was a major refactor on how variables are handled. They're now easier to understand. The ",(0,r.kt)("inlineCode",{parentName:"li"},"expansions:")," setting was removed as it became unnecessary. This is the order in which Task will process variables, each level can see the variables set by the previous one and override those.",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"Environment variables"),(0,r.kt)("li",{parentName:"ul"},"Global + CLI variables"),(0,r.kt)("li",{parentName:"ul"},"Call variables"),(0,r.kt)("li",{parentName:"ul"},"Task variables")))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/6905f42e.e4f764bf.js b/pt-BR/assets/js/6905f42e.e4f764bf.js new file mode 100644 index 00000000..5229734c --- /dev/null +++ b/pt-BR/assets/js/6905f42e.e4f764bf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[430],{3905:function(e,n,t){t.d(n,{Zo:function(){return u},kt:function(){return m}});var a=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},k=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(t),k=r,m=d["".concat(s,".").concat(k)]||d[k]||c[k]||l;return t?a.createElement(m,i(i({ref:n},u),{},{components:t})):a.createElement(m,i({ref:n},u))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=k;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[d]="string"==typeof e?e:r,i[1]=o;for(var p=2;p= v3.0.0 anymore.")),(0,r.kt)("p",null,"In the first version of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Taskfile"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"version:")," key was not available, because the tasks was in the root of the YAML document. Like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'echo:\n cmds:\n - echo "Hello, World!"\n')),(0,r.kt)("p",null,"The variable priority order was also different:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Call variables"),(0,r.kt)("li",{parentName:"ol"},"Environment"),(0,r.kt)("li",{parentName:"ol"},"Task variables"),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"Taskvars.yml")," variables")),(0,r.kt)("h2",{id:"version-20"},"Version 2.0"),(0,r.kt)("p",null,"At version 2, we introduced the ",(0,r.kt)("inlineCode",{parentName:"p"},"version:")," key, to allow us to evolve Task with new features without breaking existing Taskfiles. The new syntax is as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\ntasks:\n echo:\n cmds:\n - echo \"Hello, World!\"\n")),(0,r.kt)("p",null,"Version 2 allows you to write global variables directly in the Taskfile, if you don't want to create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Taskvars.yml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nvars:\n GREETING: Hello, World!\n\ntasks:\n greet:\n cmds:\n - echo \"{{.GREETING}}\"\n")),(0,r.kt)("p",null,"The variable priority order changed to the following:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Task variables"),(0,r.kt)("li",{parentName:"ol"},"Call variables"),(0,r.kt)("li",{parentName:"ol"},"Taskfile variables"),(0,r.kt)("li",{parentName:"ol"},"Taskvars file variables"),(0,r.kt)("li",{parentName:"ol"},"Environment variables")),(0,r.kt)("p",null,"A new global option was added to configure the number of variables expansions (which default to 2):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nexpansions: 3\n\nvars:\n FOO: foo\n BAR: bar\n BAZ: baz\n FOOBAR: '{{.FOO}}{{.BAR}}'\n FOOBARBAZ: '{{.FOOBAR}}{{.BAZ}}'\n\ntasks:\n default:\n cmds:\n - echo \"{{.FOOBARBAZ}}\"\n")),(0,r.kt)("h2",{id:"version-21"},"Version 2.1"),(0,r.kt)("p",null,"Version 2.1 includes a global ",(0,r.kt)("inlineCode",{parentName:"p"},"output")," option, to allow having more control over how commands output are printed to the console (see ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#output-syntax"},"documentation")," for more info):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\noutput: prefixed\n\ntasks:\n server:\n cmds:\n - go run main.go\n prefix: server\n")),(0,r.kt)("p",null,"From this version it's also possible to ignore errors of a command or task (check documentation ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#ignore-errors"},"here"),"):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'version: \'2\'\n\ntasks:\n example-1:\n cmds:\n - cmd: exit 1\n ignore_error: true\n - echo "This will be print"\n\n example-2:\n cmds:\n - exit 1\n - echo "This will be print"\n ignore_error: true\n')),(0,r.kt)("h2",{id:"version-22"},"Version 2.2"),(0,r.kt)("p",null,"Version 2.2 comes with a global ",(0,r.kt)("inlineCode",{parentName:"p"},"includes")," options to include other Taskfiles:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\nincludes:\n docs: ./documentation # will look for ./documentation/Taskfile.yml\n docker: ./DockerTasks.yml\n")),(0,r.kt)("h2",{id:"version-26"},"Version 2.6"),(0,r.kt)("p",null,"Version 2.6 comes with ",(0,r.kt)("inlineCode",{parentName:"p"},"preconditions")," stanza in tasks."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '2'\n\ntasks:\n upload_environment:\n preconditions:\n - test -f .env\n cmds:\n - aws s3 cp .env s3://myenvironment\n")),(0,r.kt)("p",null,"Please check the ",(0,r.kt)("a",{parentName:"p",href:"/pt-BR/usage/#including-other-taskfiles"},"documentation")),(0,r.kt)("h2",{id:"version-3"},"Version 3"),(0,r.kt)("p",null,"These are some major changes done on ",(0,r.kt)("inlineCode",{parentName:"p"},"v3"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Task's output will now be colored"),(0,r.kt)("li",{parentName:"ul"},"Added support for ",(0,r.kt)("inlineCode",{parentName:"li"},".env")," like files"),(0,r.kt)("li",{parentName:"ul"},"Added ",(0,r.kt)("inlineCode",{parentName:"li"},"label:")," setting to task so one can override how the task name appear in the logs"),(0,r.kt)("li",{parentName:"ul"},"A global ",(0,r.kt)("inlineCode",{parentName:"li"},"method:")," was added to allow setting the default method, and Task's default changed to ",(0,r.kt)("inlineCode",{parentName:"li"},"checksum")),(0,r.kt)("li",{parentName:"ul"},"Two magic variables were added when using ",(0,r.kt)("inlineCode",{parentName:"li"},"status:"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"CHECKSUM")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"TIMESTAMP")," which contains, respectively, the md5 checksum and greatest modification timestamp of the files listed on ",(0,r.kt)("inlineCode",{parentName:"li"},"sources:")),(0,r.kt)("li",{parentName:"ul"},"Also, the ",(0,r.kt)("inlineCode",{parentName:"li"},"TASK")," variable is always available with the current task name"),(0,r.kt)("li",{parentName:"ul"},"CLI variables are always treated as global variables"),(0,r.kt)("li",{parentName:"ul"},"Added ",(0,r.kt)("inlineCode",{parentName:"li"},"dir:")," option to ",(0,r.kt)("inlineCode",{parentName:"li"},"includes")," to allow choosing on which directory an included Taskfile will run:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"includes:\n docs:\n taskfile: ./docs\n dir: ./docs\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Implemented short task syntax. All below syntaxes are equivalent:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print:\n cmds:\n - echo \"Hello, World!\"\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print:\n - echo \"Hello, World!\"\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print: echo \"Hello, World!\"\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"There was a major refactor on how variables are handled. They're now easier to understand. The ",(0,r.kt)("inlineCode",{parentName:"li"},"expansions:")," setting was removed as it became unnecessary. This is the order in which Task will process variables, each level can see the variables set by the previous one and override those.",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"Environment variables"),(0,r.kt)("li",{parentName:"ul"},"Global + CLI variables"),(0,r.kt)("li",{parentName:"ul"},"Call variables"),(0,r.kt)("li",{parentName:"ul"},"Task variables")))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/8420b8df.3538c872.js b/pt-BR/assets/js/8420b8df.3538c872.js deleted file mode 100644 index 2cb80665..00000000 --- a/pt-BR/assets/js/8420b8df.3538c872.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[385],{3905:function(e,t,n){n.d(t,{Zo:function(){return m},kt:function(){return h}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),p=u(n),d=a,h=p["".concat(s,".").concat(d)]||p[d]||c[d]||o;return n?r.createElement(h,i(i({ref:t},m),{},{components:n})):r.createElement(h,i({ref:t},m))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:a,i[1]=l;for(var u=2;u')," to detect windows and run the command in Powershell directly."),(0,a.kt)("li",{parentName:"ul"},"Use a shell on Windows that supports these commands as builtins, such as ",(0,a.kt)("a",{parentName:"li",href:"https://gitforwindows.org/"},"Git Bash")," or ",(0,a.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/windows/wsl/install"},"WSL"),".")),(0,a.kt)("p",null,"We want to make improvements to this part of Task and the issues below track this work. Constructive comments and contributions are very welcome!"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/go-task/task/issues/197"},"#197")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/mvdan/sh/issues/93"},"mvdan/sh#93")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/mvdan/sh/issues/97"},"mvdan/sh#97"))))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/8420b8df.dd8684c7.js b/pt-BR/assets/js/8420b8df.dd8684c7.js new file mode 100644 index 00000000..463950d2 --- /dev/null +++ b/pt-BR/assets/js/8420b8df.dd8684c7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[385],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return f}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=u(n),d=a,f=m["".concat(s,".").concat(d)]||m[d]||c[d]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:a,i[1]=l;for(var u=2;u')," to detect windows and run the command in Powershell directly."),(0,a.kt)("li",{parentName:"ul"},"Use a shell on Windows that supports these commands as builtins, such as ",(0,a.kt)("a",{parentName:"li",href:"https://gitforwindows.org/"},"Git Bash")," or ",(0,a.kt)("a",{parentName:"li",href:"https://learn.microsoft.com/en-us/windows/wsl/install"},"WSL"),".")),(0,a.kt)("p",null,"We want to make improvements to this part of Task and the issues below track this work. Constructive comments and contributions are very welcome!"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/go-task/task/issues/197"},"#197")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/mvdan/sh/issues/93"},"mvdan/sh#93")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/mvdan/sh/issues/97"},"mvdan/sh#97"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/935f2afb.3a9c3e69.js b/pt-BR/assets/js/935f2afb.3a9c3e69.js deleted file mode 100644 index dab0c1aa..00000000 --- a/pt-BR/assets/js/935f2afb.3a9c3e69.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[53],{1109:function(e){e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Pr\xf3ximo","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"P\xe1gina Inicial","href":"/pt-BR/","docId":"intro"},{"type":"link","label":"Installation","href":"/pt-BR/installation/","docId":"installation"},{"type":"link","label":"Guia de Uso","href":"/pt-BR/usage/","docId":"usage"},{"type":"link","label":"Refer\xeancia da API","href":"/pt-BR/api/","docId":"api_reference"},{"type":"link","label":"Integrations","href":"/pt-BR/integrations/","docId":"integrations"},{"type":"link","label":"FAQ","href":"/pt-BR/faq/","docId":"faq"},{"type":"link","label":"Styleguide","href":"/pt-BR/styleguide/","docId":"styleguide"},{"type":"link","label":"Changelog","href":"/pt-BR/changelog/","docId":"changelog"},{"type":"link","label":"Community","href":"/pt-BR/community/","docId":"community"},{"type":"link","label":"Contributing","href":"/pt-BR/contributing/","docId":"contributing"},{"type":"link","label":"Releasing","href":"/pt-BR/releasing/","docId":"releasing"},{"type":"link","label":"Taskfile Versions","href":"/pt-BR/taskfile-versions/","docId":"taskfile_versions"},{"type":"link","label":"Doe","href":"/pt-BR/donate/","docId":"donate"},{"type":"link","label":"Traduza","href":"/pt-BR/translate/","docId":"translate"}]},"docs":{"api_reference":{"id":"api_reference","title":"Refer\xeancia da API","description":"CLI","sidebar":"tutorialSidebar"},"changelog":{"id":"changelog","title":"Changelog","description":"v3.25.0 - 2023-05-22","sidebar":"tutorialSidebar"},"community":{"id":"community","title":"Community","description":"Some of the work to improve the Task ecosystem is done by the community, be it installation methods or integrations with code editor. I (the author) am thankful for everyone that helps me to improve the overall experience.","sidebar":"tutorialSidebar"},"contributing":{"id":"contributing","title":"Contributing","description":"Contributions to Task are very welcome, but we ask that you read this document before submitting a PR.","sidebar":"tutorialSidebar"},"donate":{"id":"donate","title":"Doe","description":"Se voc\xea acha esse projeto \xfatil, considere doar usando um dos meios listados abaixo.","sidebar":"tutorialSidebar"},"faq":{"id":"faq","title":"FAQ","description":"This page contains a list of frequently asked questions about Task.","sidebar":"tutorialSidebar"},"installation":{"id":"installation","title":"Installation","description":"Task offers many installation methods. Check out the available methods below.","sidebar":"tutorialSidebar"},"integrations":{"id":"integrations","title":"Integrations","description":"Visual Studio Code Extension","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"P\xe1gina Inicial","description":"Task \xe9 uma ferramenta de automatiza\xe7\xe3o de tarefas que foi criada para ser mais simples de usar do que outras similares, como por exemplo o GNU Make.","sidebar":"tutorialSidebar"},"releasing":{"id":"releasing","title":"Releasing","description":"The release process of Task is done with the help of GoReleaser. You can test the release process locally by calling the test-release task of the Taskfile.","sidebar":"tutorialSidebar"},"styleguide":{"id":"styleguide","title":"Styleguide","description":"This is the official Task styleguide for Taskfile.yml files. This guide contains some basic instructions to keep your Taskfile clean and familiar to other users.","sidebar":"tutorialSidebar"},"taskfile_versions":{"id":"taskfile_versions","title":"Taskfile Versions","description":"The Taskfile syntax and features changed with time. This document explains what changed on each version and how to upgrade your Taskfile.","sidebar":"tutorialSidebar"},"translate":{"id":"translate","title":"Traduza","description":"Quer nos ajudar a traduzir esta documenta\xe7\xe3o? Neste documento, explicamos como.","sidebar":"tutorialSidebar"},"usage":{"id":"usage","title":"Guia de Uso","description":"Primeiros passos","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/935f2afb.c53862c1.js b/pt-BR/assets/js/935f2afb.c53862c1.js new file mode 100644 index 00000000..b887c373 --- /dev/null +++ b/pt-BR/assets/js/935f2afb.c53862c1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[53],{1109:function(e){e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Pr\xf3ximo","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"P\xe1gina Inicial","href":"/pt-BR/","docId":"intro"},{"type":"link","label":"Instala\xe7\xe3o","href":"/pt-BR/installation/","docId":"installation"},{"type":"link","label":"Guia de Uso","href":"/pt-BR/usage/","docId":"usage"},{"type":"link","label":"Refer\xeancia da API","href":"/pt-BR/api/","docId":"api_reference"},{"type":"link","label":"Integrations","href":"/pt-BR/integrations/","docId":"integrations"},{"type":"link","label":"Perguntas frequentes","href":"/pt-BR/faq/","docId":"faq"},{"type":"link","label":"Guia de estilo","href":"/pt-BR/styleguide/","docId":"styleguide"},{"type":"link","label":"Changelog","href":"/pt-BR/changelog/","docId":"changelog"},{"type":"link","label":"Comunidade","href":"/pt-BR/community/","docId":"community"},{"type":"link","label":"Contributing","href":"/pt-BR/contributing/","docId":"contributing"},{"type":"link","label":"Releasing","href":"/pt-BR/releasing/","docId":"releasing"},{"type":"link","label":"Vers\xf5es do Taskfile","href":"/pt-BR/taskfile-versions/","docId":"taskfile_versions"},{"type":"link","label":"Doe","href":"/pt-BR/donate/","docId":"donate"},{"type":"link","label":"Traduza","href":"/pt-BR/translate/","docId":"translate"}]},"docs":{"api_reference":{"id":"api_reference","title":"Refer\xeancia da API","description":"CLI","sidebar":"tutorialSidebar"},"changelog":{"id":"changelog","title":"Changelog","description":"v3.25.0 - 2023-05-22","sidebar":"tutorialSidebar"},"community":{"id":"community","title":"Comunidade","description":"Some of the work to improve the Task ecosystem is done by the community, be it installation methods or integrations with code editor. I (the author) am thankful for everyone that helps me to improve the overall experience.","sidebar":"tutorialSidebar"},"contributing":{"id":"contributing","title":"Contributing","description":"Contributions to Task are very welcome, but we ask that you read this document before submitting a PR.","sidebar":"tutorialSidebar"},"donate":{"id":"donate","title":"Doe","description":"Se voc\xea acha esse projeto \xfatil, considere doar usando um dos meios listados abaixo.","sidebar":"tutorialSidebar"},"faq":{"id":"faq","title":"Perguntas frequentes","description":"This page contains a list of frequently asked questions about Task.","sidebar":"tutorialSidebar"},"installation":{"id":"installation","title":"Instala\xe7\xe3o","description":"H\xe1 muitas maneiras poss\xedveis de se instalar o Task. Confira os m\xe9todos dispon\xedveis abaixo.","sidebar":"tutorialSidebar"},"integrations":{"id":"integrations","title":"Integrations","description":"Visual Studio Code Extension","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"P\xe1gina Inicial","description":"Task \xe9 uma ferramenta de automatiza\xe7\xe3o que foi criada para ser mais simples de usar do que outras similares, como por exemplo o GNU Make.","sidebar":"tutorialSidebar"},"releasing":{"id":"releasing","title":"Releasing","description":"The release process of Task is done with the help of GoReleaser. You can test the release process locally by calling the test-release task of the Taskfile.","sidebar":"tutorialSidebar"},"styleguide":{"id":"styleguide","title":"Guia de estilo","description":"This is the official Task styleguide for Taskfile.yml files. This guide contains some basic instructions to keep your Taskfile clean and familiar to other users.","sidebar":"tutorialSidebar"},"taskfile_versions":{"id":"taskfile_versions","title":"Vers\xf5es do Taskfile","description":"The Taskfile syntax and features changed with time. This document explains what changed on each version and how to upgrade your Taskfile.","sidebar":"tutorialSidebar"},"translate":{"id":"translate","title":"Traduza","description":"Quer nos ajudar a traduzir esta documenta\xe7\xe3o? Neste documento, explicamos como.","sidebar":"tutorialSidebar"},"usage":{"id":"usage","title":"Guia de Uso","description":"Primeiros passos","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/ad872c75.5776bf79.js b/pt-BR/assets/js/ad872c75.5776bf79.js new file mode 100644 index 00000000..917aac86 --- /dev/null +++ b/pt-BR/assets/js/ad872c75.5776bf79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[364],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return f}});var a=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=u(n),d=i,f=p["".concat(l,".").concat(d)]||p[d]||m[d]||o;return n?a.createElement(f,r(r({ref:t},c),{},{components:n})):a.createElement(f,r({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[p]="string"==typeof e?e:i,r[1]=s;for(var u=2;u=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=u(n),d=i,f=p["".concat(l,".").concat(d)]||p[d]||m[d]||o;return n?a.createElement(f,r(r({ref:t},c),{},{components:n})):a.createElement(f,r({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[p]="string"==typeof e?e:i,r[1]=s;for(var u=2;u=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var r=a.createContext({}),p=function(e){var n=a.useContext(r),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},d=function(e){var n=p(e.components);return a.createElement(r.Provider,{value:n},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,l=e.originalType,r=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),u=p(t),c=i,k=u["".concat(r,".").concat(c)]||u[c]||m[c]||l;return t?a.createElement(k,s(s({ref:n},d),{},{components:t})):a.createElement(k,s({ref:n},d))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var l=t.length,s=new Array(l);s[0]=c;var o={};for(var r in n)hasOwnProperty.call(n,r)&&(o[r]=n[r]);o.originalType=e,o[u]="string"==typeof e?e:i,s[1]=o;for(var p=2;pdefer",id:"doing-task-cleanup-with-defer",level:2},{value:"Go's template engine",id:"gos-template-engine",level:2},{value:"Help",id:"help",level:2},{value:"Display summary of task",id:"display-summary-of-task",level:2},{value:"Task aliases",id:"task-aliases",level:2},{value:"Overriding task name",id:"overriding-task-name",level:2},{value:"Silent mode",id:"silent-mode",level:2},{value:"Dry run mode",id:"dry-run-mode",level:2},{value:"Ignore errors",id:"ignore-errors",level:2},{value:"Output syntax",id:"output-syntax",level:2},{value:"Interactive CLI application",id:"interactive-cli-application",level:2},{value:"Short task syntax",id:"short-task-syntax",level:2},{value:"set and shopt",id:"set-and-shopt",level:2},{value:"Watch tasks",id:"watch-tasks",level:2}],d={toc:p};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"guia-de-uso"},"Guia de Uso"),(0,i.kt)("h2",{id:"primeiros-passos"},"Primeiros passos"),(0,i.kt)("p",null,"Create a file called ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," in the root of your project. The ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds")," attribute should contain the commands of a task. The example below allows compiling a Go app and uses ",(0,i.kt)("a",{parentName:"p",href:"https://esbuild.github.io/"},"esbuild")," to concat and minify multiple CSS files into a single one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build -v -i main.go\n\n assets:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"Running the tasks is as simple as running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"task assets build\n")),(0,i.kt)("p",null,"Task uses ",(0,i.kt)("a",{parentName:"p",href:"https://mvdan.cc/sh/"},"mvdan.cc/sh"),", a native Go sh interpreter. So you can write sh/bash commands, and it will work even on Windows, where ",(0,i.kt)("inlineCode",{parentName:"p"},"sh")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"bash")," are usually not available. Just remember any executable called must be available by the OS or in PATH."),(0,i.kt)("p",null,'If you omit a task name, "default" will be assumed.'),(0,i.kt)("h2",{id:"supported-file-names"},"Supported file names"),(0,i.kt)("p",null,"Task will look for the following file names, in order of priority:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Taskfile.yml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.yaml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.dist.yml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.dist.yaml")),(0,i.kt)("p",null,"The intention of having the ",(0,i.kt)("inlineCode",{parentName:"p"},".dist")," variants is to allow projects to have one committed version (",(0,i.kt)("inlineCode",{parentName:"p"},".dist"),") while still allowing individual users to override the Taskfile by adding an additional ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," (which would be on ",(0,i.kt)("inlineCode",{parentName:"p"},".gitignore"),")."),(0,i.kt)("h3",{id:"running-a-taskfile-from-a-subdirectory"},"Running a Taskfile from a subdirectory"),(0,i.kt)("p",null,"If a Taskfile cannot be found in the current working directory, it will walk up the file tree until it finds one (similar to how ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," works). When running Task from a subdirectory like this, it will behave as if you ran it from the directory containing the Taskfile."),(0,i.kt)("p",null,"You can use this functionality along with the special ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.USER_WORKING_DIR}}")," variable to create some very useful reusable tasks. For example, if you have a monorepo with directories for each microservice, you can ",(0,i.kt)("inlineCode",{parentName:"p"},"cd")," into a microservice directory and run a task command to bring it up without having to create multiple tasks or Taskfiles with identical content. For example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n up:\n dir: '{{.USER_WORKING_DIR}}'\n preconditions:\n - test -f docker-compose.yml\n cmds:\n - docker-compose up -d\n")),(0,i.kt)("p",null,"In this example, we can run ",(0,i.kt)("inlineCode",{parentName:"p"},"cd ")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"task up")," and as long as the ",(0,i.kt)("inlineCode",{parentName:"p"},"")," directory contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"docker-compose.yml"),", the Docker composition will be brought up."),(0,i.kt)("h3",{id:"running-a-global-taskfile"},"Running a global Taskfile"),(0,i.kt)("p",null,"If you call Task with the ",(0,i.kt)("inlineCode",{parentName:"p"},"--global")," (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-g"),") flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile on either ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME/Taskfile.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME/Taskfile.yaml")," paths."),(0,i.kt)("p",null,"This is useful to have automation that you can run from anywhere in your system!"),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"When running your global Taskfile with ",(0,i.kt)("inlineCode",{parentName:"p"},"-g"),", tasks will run on ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME")," by default, and not on your working directory!"),(0,i.kt)("p",{parentName:"admonition"},"As mentioned in the previous section, the ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.USER_WORKING_DIR}}")," special variable can be very handy here to run stuff on the directory you're calling ",(0,i.kt)("inlineCode",{parentName:"p"},"task -g")," from."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n from-home:\n cmds:\n - pwd\n\n from-working-directory:\n dir: '{{.USER_WORKING_DIR}}'\n cmds:\n - pwd\n"))),(0,i.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,i.kt)("h3",{id:"task"},"Task"),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"env")," to set custom environment variables for a specific task:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n greet:\n cmds:\n - echo $GREETING\n env:\n GREETING: Hey, there!\n")),(0,i.kt)("p",null,"Additionally, you can set global environment variables that will be available to all tasks:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n GREETING: Hey, there!\n\ntasks:\n greet:\n cmds:\n - echo $GREETING\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"env")," supports expansion and retrieving output from a shell command just like variables, as you can see in the ",(0,i.kt)("a",{parentName:"p",href:"#variables"},"Variables")," section.")),(0,i.kt)("h3",{id:"env-files"},".env files"),(0,i.kt)("p",null,"You can also ask Task to include ",(0,i.kt)("inlineCode",{parentName:"p"},".env")," like files by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"dotenv:")," setting:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title=".env"',title:'".env"'},"KEYNAME=VALUE\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="testing/.env"',title:'"testing/.env"'},"ENDPOINT=testing.com\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Taskfile.yml"',title:'"Taskfile.yml"'},"version: '3'\n\nenv:\n ENV: testing\n\ndotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n\ntasks:\n greet:\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("p",null,"Dotenv files can also be specified at the task level:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n ENV: testing\n\ntasks:\n greet:\n dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("p",null,"Environment variables specified explicitly at the task-level will override variables defined in dotfiles:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n ENV: testing\n\ntasks:\n greet:\n dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n env:\n KEYNAME: DIFFERENT_VALUE\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note that you are not currently able to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"dotenv")," key inside included Taskfiles.")),(0,i.kt)("h2",{id:"including-other-taskfiles"},"Including other Taskfiles"),(0,i.kt)("p",null,"If you want to share tasks between different projects (Taskfiles), you can use the importing mechanism to include other Taskfiles using the ",(0,i.kt)("inlineCode",{parentName:"p"},"includes")," keyword:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n docs: ./documentation # will look for ./documentation/Taskfile.yml\n docker: ./DockerTasks.yml\n")),(0,i.kt)("p",null,"The tasks described in the given Taskfiles will be available with the informed namespace. So, you'd call ",(0,i.kt)("inlineCode",{parentName:"p"},"task docs:serve")," to run the ",(0,i.kt)("inlineCode",{parentName:"p"},"serve")," task from ",(0,i.kt)("inlineCode",{parentName:"p"},"documentation/Taskfile.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"task docker:build")," to run the ",(0,i.kt)("inlineCode",{parentName:"p"},"build")," task from the ",(0,i.kt)("inlineCode",{parentName:"p"},"DockerTasks.yml")," file."),(0,i.kt)("p",null,"Relative paths are resolved relative to the directory containing the including Taskfile."),(0,i.kt)("h3",{id:"os-specific-taskfiles"},"OS-specific Taskfiles"),(0,i.kt)("p",null,"With ",(0,i.kt)("inlineCode",{parentName:"p"},"version: '2'"),", task automatically includes any ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_{{OS}}.yml")," if it exists (for example: ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_windows.yml"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_linux.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_darwin.yml"),"). Since this behavior was a bit too implicit, it was removed on version 3, but you still can have a similar behavior by explicitly importing these files:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n build: ./Taskfile_{{OS}}.yml\n")),(0,i.kt)("h3",{id:"directory-of-included-taskfile"},"Directory of included Taskfile"),(0,i.kt)("p",null,"By default, included Taskfile's tasks are run in the current directory, even if the Taskfile is in another directory, but you can force its tasks to run in another directory by using this alternative syntax:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n docs:\n taskfile: ./docs/Taskfile.yml\n dir: ./docs\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"The included Taskfiles must be using the same schema version as the main Taskfile uses.")),(0,i.kt)("h3",{id:"optional-includes"},"Optional includes"),(0,i.kt)("p",null,"Includes marked as optional will allow Task to continue execution as normal if the included file is missing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n tests:\n taskfile: ./tests/Taskfile.yml\n optional: true\n\ntasks:\n greet:\n cmds:\n - echo \"This command can still be successfully executed if\n ./tests/Taskfile.yml does not exist\"\n")),(0,i.kt)("h3",{id:"internal-includes"},"Internal includes"),(0,i.kt)("p",null,"Includes marked as internal will set all the tasks of the included file to be internal as well (see the ",(0,i.kt)("a",{parentName:"p",href:"#internal-tasks"},"Internal tasks")," section below). This is useful when including utility tasks that are not intended to be used directly by the user."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n tests:\n taskfile: ./taskfiles/Utils.yml\n internal: true\n")),(0,i.kt)("h3",{id:"vars-of-included-taskfiles"},"Vars of included Taskfiles"),(0,i.kt)("p",null,"You can also specify variables when including a Taskfile. This may be useful for having reusable Taskfile that can be tweaked or even included more than once:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n backend:\n taskfile: ./taskfiles/Docker.yml\n vars:\n DOCKER_IMAGE: backend_image\n\n frontend:\n taskfile: ./taskfiles/Docker.yml\n vars:\n DOCKER_IMAGE: frontend_image\n")),(0,i.kt)("h3",{id:"namespace-aliases"},"Namespace aliases"),(0,i.kt)("p",null,"When including a Taskfile, you can give the namespace a list of ",(0,i.kt)("inlineCode",{parentName:"p"},"aliases"),". This works in the same way as ",(0,i.kt)("a",{parentName:"p",href:"#task-aliases"},"task aliases")," and can be used together to create shorter and easier-to-type commands."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n generate:\n taskfile: ./taskfiles/Generate.yml\n aliases: [gen]\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"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 ",(0,i.kt)("a",{parentName:"p",href:"https://go-task.github.io/slim-sprig/defaults.html"},"default function"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"MY_VAR: '{{.MY_VAR | default \"my-default-value\"}}'"),".")),(0,i.kt)("h2",{id:"internal-tasks"},"Internal tasks"),(0,i.kt)("p",null,"Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-image-1:\n cmds:\n - task: build-image\n vars:\n DOCKER_IMAGE: image-1\n\n build-image:\n internal: true\n cmds:\n - docker build -t {{.DOCKER_IMAGE}} .\n")),(0,i.kt)("h2",{id:"task-directory"},"Task directory"),(0,i.kt)("p",null,"By default, tasks will be executed in the directory where the Taskfile is located. But you can easily make the task run in another folder, informing ",(0,i.kt)("inlineCode",{parentName:"p"},"dir"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n serve:\n dir: public/www\n cmds:\n # run http server\n - caddy\n")),(0,i.kt)("p",null,"If the directory does not exist, ",(0,i.kt)("inlineCode",{parentName:"p"},"task")," creates it."),(0,i.kt)("h2",{id:"task-dependencies"},"Task dependencies"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Dependencies run in parallel, so dependencies of a task should not depend one another. If you want to force tasks to run serially, take a look at the ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"Calling Another Task")," section below.")),(0,i.kt)("p",null,"You may have tasks that depend on others. Just pointing them on ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," will make them run automatically before running the parent task:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n deps: [assets]\n cmds:\n - go build -v -i main.go\n\n assets:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"In the above example, ",(0,i.kt)("inlineCode",{parentName:"p"},"assets")," will always run right before ",(0,i.kt)("inlineCode",{parentName:"p"},"build")," if you run ",(0,i.kt)("inlineCode",{parentName:"p"},"task build"),"."),(0,i.kt)("p",null,"A task can have only dependencies and no commands to group tasks together:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n assets:\n deps: [js, css]\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"If there is more than one dependency, they always run in parallel for better performance."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"You can also make the tasks given by the command line run in parallel by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"--parallel")," flag (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-p"),"). Example: ",(0,i.kt)("inlineCode",{parentName:"p"},"task --parallel js css"),".")),(0,i.kt)("p",null,"If you want to pass information to dependencies, you can do that the same manner as you would to ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"call another task"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n deps:\n - task: echo_sth\n vars: { TEXT: 'before 1' }\n - task: echo_sth\n vars: { TEXT: 'before 2' }\n silent: true\n cmds:\n - echo \"after\"\n\n echo_sth:\n cmds:\n - echo {{.TEXT}}\n")),(0,i.kt)("h2",{id:"platform-specific-tasks-and-commands"},"Platform specific tasks and commands"),(0,i.kt)("p",null,"If you want to restrict the running of tasks to explicit platforms, this can be achieved using the ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("p",null,"The values allowed as OS or Arch are valid ",(0,i.kt)("inlineCode",{parentName:"p"},"GOOS")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"GOARCH")," values, as defined by the Go language ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/golang/go/blob/master/src/go/build/syslist.go"},"here"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"build-windows")," task below will run only on Windows, and on any architecture:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-windows:\n platforms: [windows]\n cmds:\n - echo 'Running command on Windows'\n")),(0,i.kt)("p",null,"This can be restricted to a specific architecture as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-windows-amd64:\n platforms: [windows/amd64]\n cmds:\n - echo 'Running command on Windows (amd64)'\n")),(0,i.kt)("p",null,"It is also possible to restrict the task to specific architectures:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-amd64:\n platforms: [amd64]\n cmds:\n - echo 'Running command on amd64'\n")),(0,i.kt)("p",null,"Multiple platforms can be specified as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n platforms: [windows/amd64, darwin]\n cmds:\n - echo 'Running command on Windows (amd64) and macOS'\n")),(0,i.kt)("p",null,"Individual commands can also be restricted to specific platforms:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - cmd: echo 'Running command on Windows (amd64) and macOS'\n platforms: [windows/amd64, darwin]\n - cmd: echo 'Running on all platforms'\n")),(0,i.kt)("h2",{id:"calling-another-task"},"Calling another task"),(0,i.kt)("p",null,"When a task has many dependencies, they are executed concurrently. This will often result in a faster build pipeline. However, in some situations, you may need to call other tasks serially. In this case, use the following syntax:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'version: \'3\'\n\ntasks:\n main-task:\n cmds:\n - task: task-to-be-called\n - task: another-task\n - echo "Both done"\n\n task-to-be-called:\n cmds:\n - echo "Task to be called"\n\n another-task:\n cmds:\n - echo "Another task"\n')),(0,i.kt)("p",null,"Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"vars")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"silent")," attributes you can choose to pass variables and toggle ",(0,i.kt)("a",{parentName:"p",href:"#silent-mode"},"silent mode")," on a call-by-call basis:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n greet:\n vars:\n RECIPIENT: '{{default \"World\" .RECIPIENT}}'\n cmds:\n - echo \"Hello, {{.RECIPIENT}}!\"\n\n greet-pessimistically:\n cmds:\n - task: greet\n vars: { RECIPIENT: 'Cruel World' }\n silent: true\n")),(0,i.kt)("p",null,"The above syntax is also supported in ",(0,i.kt)("inlineCode",{parentName:"p"},"deps"),"."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"NOTE: If you want to call a task declared in the root Taskfile from within an ",(0,i.kt)("a",{parentName:"p",href:"#including-other-taskfiles"},"included Taskfile"),", add a leading ",(0,i.kt)("inlineCode",{parentName:"p"},":")," like this: ",(0,i.kt)("inlineCode",{parentName:"p"},"task: :task-name"),".")),(0,i.kt)("h2",{id:"prevent-unnecessary-work"},"Prevent unnecessary work"),(0,i.kt)("h3",{id:"by-fingerprinting-locally-generated-files-and-their-sources"},"By fingerprinting locally generated files and their sources"),(0,i.kt)("p",null,"If a task generates something, you can inform Task the source and generated files, so Task will prevent running them if not necessary."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n deps: [js, css]\n cmds:\n - go build -v -i main.go\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n sources:\n - src/js/**/*.js\n generates:\n - public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n sources:\n - src/css/**/*.css\n generates:\n - public/bundle.css\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"sources")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"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 ",(0,i.kt)("inlineCode",{parentName:"p"},'Task "js" is up to date'),"."),(0,i.kt)("p",null,"If you prefer this check to be made by the modification timestamp of the files, instead of its checksum (content), just set the ",(0,i.kt)("inlineCode",{parentName:"p"},"method")," property to ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build .\n sources:\n - ./*.go\n generates:\n - app{{exeExt}}\n method: timestamp\n")),(0,i.kt)("p",null,"In situations where you need more flexibility the ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," keyword can be used. You can even combine the two. See the documentation for ",(0,i.kt)("a",{parentName:"p",href:"#using-programmatic-checks-to-indicate-a-task-is-up-to-date"},"status")," for an example."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"By default, task stores checksums on a local ",(0,i.kt)("inlineCode",{parentName:"p"},".task")," directory in the project's directory. Most of the time, you'll want to have this directory on ",(0,i.kt)("inlineCode",{parentName:"p"},".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)."),(0,i.kt)("p",{parentName:"admonition"},"If you want these files to be stored in another directory, you can set a ",(0,i.kt)("inlineCode",{parentName:"p"},"TASK_TEMP_DIR")," environment variable in your machine. It can contain a relative path like ",(0,i.kt)("inlineCode",{parentName:"p"},"tmp/task")," that will be interpreted as relative to the project directory, or an absolute or home path like ",(0,i.kt)("inlineCode",{parentName:"p"},"/tmp/.task")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.task")," (subdirectories will be created for each project)."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"export TASK_TEMP_DIR='~/.task'\n"))),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Each task has only one checksum stored for its ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("p",{parentName:"admonition"},"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.")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The method ",(0,i.kt)("inlineCode",{parentName:"p"},"none")," skips any validation and always run the task.")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"checksum")," (default) or ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp")," method to work, it is only necessary to inform the source files. When the ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp")," method is used, the last time of the running the task is considered as a generate.")),(0,i.kt)("h3",{id:"using-programmatic-checks-to-indicate-a-task-is-up-to-date"},"Using programmatic checks to indicate a task is up to date"),(0,i.kt)("p",null,"Alternatively, you can inform a sequence of tests as ",(0,i.kt)("inlineCode",{parentName:"p"},"status"),". If no error is returned (exit status 0), the task is considered up-to-date:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate-files:\n cmds:\n - mkdir directory\n - touch directory/file1.txt\n - touch directory/file2.txt\n # test existence of files\n status:\n - test -d directory\n - test -f directory/file1.txt\n - test -f directory/file2.txt\n")),(0,i.kt)("p",null,"Normally, you would use ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"generates")," - but for tasks that generate remote artifacts (Docker images, deploys, CD releases) the checksum source and timestamps require either access to the artifact or for an out-of-band refresh of the ",(0,i.kt)("inlineCode",{parentName:"p"},".checksum")," fingerprint file."),(0,i.kt)("p",null,"Two special variables ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.CHECKSUM}}")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.TIMESTAMP}}")," are available for interpolation within ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," commands, depending on the method assigned to fingerprint the sources. Only ",(0,i.kt)("inlineCode",{parentName:"p"},"source")," globs are fingerprinted."),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.TIMESTAMP}}"),' variable is a "live" Go ',(0,i.kt)("inlineCode",{parentName:"p"},"time.Time")," struct, and can be formatted using any of the methods that ",(0,i.kt)("inlineCode",{parentName:"p"},"time.Time")," responds to."),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"https://golang.org/pkg/time/"},"the Go Time documentation")," for more information."),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"--force")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-f")," if you want to force a task to run even when up-to-date."),(0,i.kt)("p",null,"Also, ",(0,i.kt)("inlineCode",{parentName:"p"},"task --status [tasks]...")," will exit with a non-zero exit code if any of the tasks are not up-to-date."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"status")," can be combined with the ",(0,i.kt)("a",{parentName:"p",href:"#by-fingerprinting-locally-generated-files-and-their-sources"},"fingerprinting")," to have a task run if either the the source/generated artifacts changes, or the programmatic check fails:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:prod:\n desc: Build for production usage.\n cmds:\n - composer install\n # Run this task if source files changes.\n sources:\n - composer.json\n - composer.lock\n generates:\n - ./vendor/composer/installed.json\n - ./vendor/autoload.php\n # But also run the task if the last build was not a production build.\n status:\n - grep -q '\"dev\": false' ./vendor/composer/installed.json\n")),(0,i.kt)("h3",{id:"using-programmatic-checks-to-cancel-the-execution-of-a-task-and-its-dependencies"},"Using programmatic checks to cancel the execution of a task and its dependencies"),(0,i.kt)("p",null,"In addition to ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," checks, ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," checks are the logical inverse of ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," checks. That is, if you need a certain set of conditions to be ",(0,i.kt)("em",{parentName:"p"},"true")," you can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," stanza. ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," are similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," lines, except they support ",(0,i.kt)("inlineCode",{parentName:"p"},"sh")," expansion, and they SHOULD all return 0."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate-files:\n cmds:\n - mkdir directory\n - touch directory/file1.txt\n - touch directory/file2.txt\n # test existence of files\n preconditions:\n - test -f .env\n - sh: '[ 1 = 0 ]'\n msg: \"One doesn't equal Zero, Halting\"\n")),(0,i.kt)("p",null,"Preconditions can set specific failure messages that can tell a user what steps to take using the ",(0,i.kt)("inlineCode",{parentName:"p"},"msg")," field."),(0,i.kt)("p",null,"If a task has a dependency on a sub-task with a precondition, and that precondition is not met - the calling task will fail. Note that a task executed with a failing precondition will not run unless ",(0,i.kt)("inlineCode",{parentName:"p"},"--force")," is given."),(0,i.kt)("p",null,"Unlike ",(0,i.kt)("inlineCode",{parentName:"p"},"status"),", which will skip a task if it is up to date and continue executing tasks that depend on it, a ",(0,i.kt)("inlineCode",{parentName:"p"},"precondition")," will fail a task, along with any other tasks that depend on it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n task-will-fail:\n preconditions:\n - sh: 'exit 1'\n\n task-will-also-fail:\n deps:\n - task-will-fail\n\n task-will-still-fail:\n cmds:\n - task: task-will-fail\n - echo \"I will not run\"\n")),(0,i.kt)("h3",{id:"limiting-when-tasks-run"},"Limiting when tasks run"),(0,i.kt)("p",null,"If a task executed by multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds")," or multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," you can control when it is executed using ",(0,i.kt)("inlineCode",{parentName:"p"},"run"),". ",(0,i.kt)("inlineCode",{parentName:"p"},"run")," can also be set at the root of the Taskfile to change the behavior of all the tasks unless explicitly overridden."),(0,i.kt)("p",null,"Supported values for ",(0,i.kt)("inlineCode",{parentName:"p"},"run"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"always")," (default) always attempt to invoke the task regardless of the number of previous executions"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"once")," only invoke this task once regardless of the number of references"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"when_changed")," only invokes the task once for each unique set of variables passed into the task")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - task: generate-file\n vars: { CONTENT: '1' }\n - task: generate-file\n vars: { CONTENT: '2' }\n - task: generate-file\n vars: { CONTENT: '2' }\n\n generate-file:\n run: when_changed\n deps:\n - install-deps\n cmds:\n - echo {{.CONTENT}}\n\n install-deps:\n run: once\n cmds:\n - sleep 5 # long operation like installing packages\n")),(0,i.kt)("h2",{id:"variables"},"Variables"),(0,i.kt)("p",null,"When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variables declared in the task definition"),(0,i.kt)("li",{parentName:"ul"},"Variables given while calling a task from another (See ",(0,i.kt)("a",{parentName:"li",href:"#calling-another-task"},"Calling another task")," above)"),(0,i.kt)("li",{parentName:"ul"},"Variables of the ",(0,i.kt)("a",{parentName:"li",href:"#including-other-taskfiles"},"included Taskfile")," (when the task is included)"),(0,i.kt)("li",{parentName:"ul"},"Variables of the ",(0,i.kt)("a",{parentName:"li",href:"#vars-of-included-taskfiles"},"inclusion of the Taskfile")," (when the task is included)"),(0,i.kt)("li",{parentName:"ul"},"Global variables (those declared in the ",(0,i.kt)("inlineCode",{parentName:"li"},"vars:")," option in the Taskfile)"),(0,i.kt)("li",{parentName:"ul"},"Environment variables")),(0,i.kt)("p",null,"Example of sending parameters with environment variables:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ TASK_VARIABLE=a-value task do-something\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"A special variable ",(0,i.kt)("inlineCode",{parentName:"p"},".TASK")," is always available containing the task name.")),(0,i.kt)("p",null,"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."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'$ task write-file FILE=file.txt "CONTENT=Hello, World!" print "MESSAGE=All done!"\n')),(0,i.kt)("p",null,"Example of locally declared vars:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-var:\n cmds:\n - echo \"{{.VAR}}\"\n vars:\n VAR: Hello!\n")),(0,i.kt)("p",null,"Example of global vars in a ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nvars:\n GREETING: Hello from Taskfile!\n\ntasks:\n greet:\n cmds:\n - echo \"{{.GREETING}}\"\n")),(0,i.kt)("h3",{id:"dynamic-variables"},"Dynamic variables"),(0,i.kt)("p",null,"The below syntax (",(0,i.kt)("inlineCode",{parentName:"p"},"sh:")," prop in a variable) is considered a dynamic variable. The value will be treated as a command and the output assigned. If there are one or more trailing newlines, the last newline will be trimmed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build -ldflags=\"-X main.Version={{.GIT_COMMIT}}\" main.go\n vars:\n GIT_COMMIT:\n sh: git log -n 1 --format=%h\n")),(0,i.kt)("p",null,"This works for all types of variables."),(0,i.kt)("h2",{id:"forwarding-cli-arguments-to-commands"},"Forwarding CLI arguments to commands"),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"--")," is given in the CLI, all following parameters are added to a special ",(0,i.kt)("inlineCode",{parentName:"p"},".CLI_ARGS")," variable. This is useful to forward arguments to another command."),(0,i.kt)("p",null,"The below example will run ",(0,i.kt)("inlineCode",{parentName:"p"},"yarn install"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task yarn -- install\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n yarn:\n cmds:\n - yarn {{.CLI_ARGS}}\n")),(0,i.kt)("h2",{id:"doing-task-cleanup-with-defer"},"Doing task cleanup with ",(0,i.kt)("inlineCode",{parentName:"h2"},"defer")),(0,i.kt)("p",null,"With the ",(0,i.kt)("inlineCode",{parentName:"p"},"defer")," keyword, it's possible to schedule cleanup to be run once the task finishes. The difference with just putting it as the last command is that this command will run even when the task fails."),(0,i.kt)("p",null,"In the example below, ",(0,i.kt)("inlineCode",{parentName:"p"},"rm -rf tmpdir/")," will run even if the third command fails:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - mkdir -p tmpdir/\n - defer: rm -rf tmpdir/\n - echo 'Do work on tmpdir/'\n")),(0,i.kt)("p",null,"If you want to move the cleanup command into another task, that is possible as well:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - mkdir -p tmpdir/\n - defer: { task: cleanup }\n - echo 'Do work on tmpdir/'\n\n cleanup: rm -rf tmpdir/\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Due to the nature of how the ",(0,i.kt)("a",{parentName:"p",href:"https://go.dev/tour/flowcontrol/13"},"Go's own ",(0,i.kt)("inlineCode",{parentName:"a"},"defer")," work"),", the deferred commands are executed in the reverse order if you schedule multiple of them.")),(0,i.kt)("h2",{id:"gos-template-engine"},"Go's template engine"),(0,i.kt)("p",null,"Task parse commands as ",(0,i.kt)("a",{parentName:"p",href:"https://golang.org/pkg/text/template/"},"Go's template engine")," before executing them. Variables are accessible through dot syntax (",(0,i.kt)("inlineCode",{parentName:"p"},".VARNAME"),")."),(0,i.kt)("p",null,"All functions by the Go's ",(0,i.kt)("a",{parentName:"p",href:"https://go-task.github.io/slim-sprig/"},"slim-sprig lib")," are available. The following example gets the current date in a given format:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-date:\n cmds:\n - echo {{now | date \"2006-01-02\"}}\n")),(0,i.kt)("p",null,"Task also adds the following functions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"OS"),': Returns the operating system. Possible values are "windows", "linux", "darwin" (macOS) and "freebsd".'),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ARCH"),': return the architecture Task was compiled to: "386", "amd64", "arm" or "s390x".'),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"splitLines"),": Splits Unix (\\n) and Windows (\\r\\n) styled newlines."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"catLines"),": Replaces Unix (\\n) and Windows (\\r\\n) styled newlines with a space."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"toSlash"),": Does nothing on Unix, but on Windows converts a string from ",(0,i.kt)("inlineCode",{parentName:"li"},"\\")," path format to ",(0,i.kt)("inlineCode",{parentName:"li"},"/"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"fromSlash"),": Opposite of ",(0,i.kt)("inlineCode",{parentName:"li"},"toSlash"),". Does nothing on Unix, but on Windows converts a string from ",(0,i.kt)("inlineCode",{parentName:"li"},"/")," path format to ",(0,i.kt)("inlineCode",{parentName:"li"},"\\"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"exeExt"),": Returns the right executable extension for the current OS (",(0,i.kt)("inlineCode",{parentName:"li"},'".exe"')," for Windows, ",(0,i.kt)("inlineCode",{parentName:"li"},'""')," for others)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"shellQuote"),": Quotes a string to make it safe for use in shell scripts. Task uses ",(0,i.kt)("a",{parentName:"li",href:"https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote"},"this Go function")," for this. The Bash dialect is assumed."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"splitArgs"),": Splits a string as if it were a command's arguments. Task uses ",(0,i.kt)("a",{parentName:"li",href:"https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/shell#Fields"},"this Go function"))),(0,i.kt)("p",null,"Example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-os:\n cmds:\n - echo '{{OS}} {{ARCH}}'\n - echo '{{if eq OS \"windows\"}}windows-command{{else}}unix-command{{end}}'\n # This will be path/to/file on Unix but path\\to\\file on Windows\n - echo '{{fromSlash \"path/to/file\"}}'\n enumerated-file:\n vars:\n CONTENT: |\n foo\n bar\n cmds:\n - |\n cat << EOF > output.txt\n {{range $i, $line := .CONTENT | splitLines -}}\n {{printf \"%3d\" $i}}: {{$line}}\n {{end}}EOF\n")),(0,i.kt)("h2",{id:"help"},"Help"),(0,i.kt)("p",null,"Running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --list")," (or ",(0,i.kt)("inlineCode",{parentName:"p"},"task -l"),") lists all tasks with a description. The following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n desc: Build the go binary.\n cmds:\n - go build -v -i main.go\n\n test:\n desc: Run all the go tests.\n cmds:\n - go test -race ./...\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"would print the following output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"* build: Build the go binary.\n* test: Run all the go tests.\n")),(0,i.kt)("p",null,"If you want to see all tasks, there's a ",(0,i.kt)("inlineCode",{parentName:"p"},"--list-all")," (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-a"),") flag as well."),(0,i.kt)("h2",{id:"display-summary-of-task"},"Display summary of task"),(0,i.kt)("p",null,"Running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --summary task-name")," will show a summary of a task. The following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n release:\n deps: [build]\n summary: |\n Release your project to github\n\n It will build your project before starting the release.\n Please make sure that you have set GITHUB_TOKEN before starting.\n cmds:\n - your-release-tool\n\n build:\n cmds:\n - your-build-tool\n")),(0,i.kt)("p",null,"with running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --summary release")," would print the following output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"task: release\n\nRelease your project to github\n\nIt will build your project before starting the release.\nPlease make sure that you have set GITHUB_TOKEN before starting.\n\ndependencies:\n - build\n\ncommands:\n - your-release-tool\n")),(0,i.kt)("p",null,"If a summary is missing, the description will be printed. If the task does not have a summary or a description, a warning is printed."),(0,i.kt)("p",null,"Please note: ",(0,i.kt)("em",{parentName:"p"},"showing the summary will not execute the command"),"."),(0,i.kt)("h2",{id:"task-aliases"},"Task aliases"),(0,i.kt)("p",null,"Aliases are alternative names for tasks. They can be used to make it easier and quicker to run tasks with long or hard-to-type names. You can use them on the command line, when ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"calling sub-tasks")," in your Taskfile and when ",(0,i.kt)("a",{parentName:"p",href:"#including-other-taskfiles"},"including tasks")," with aliases from another Taskfile. They can also be used together with ",(0,i.kt)("a",{parentName:"p",href:"#namespace-aliases"},"namespace aliases"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate:\n aliases: [gen]\n cmds:\n - task: gen-mocks\n\n generate-mocks:\n aliases: [gen-mocks]\n cmds:\n - echo \"generating...\"\n")),(0,i.kt)("h2",{id:"overriding-task-name"},"Overriding task name"),(0,i.kt)("p",null,"Sometimes you may want to override the task name printed on the summary, up-to-date messages to STDOUT, etc. In this case, you can just set ",(0,i.kt)("inlineCode",{parentName:"p"},"label:"),", which can also be interpolated with variables:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n - task: print\n vars:\n MESSAGE: hello\n - task: print\n vars:\n MESSAGE: world\n\n print:\n label: 'print-{{.MESSAGE}}'\n cmds:\n - echo \"{{.MESSAGE}}\"\n")),(0,i.kt)("h2",{id:"silent-mode"},"Silent mode"),(0,i.kt)("p",null,"Silent mode disables the echoing of commands before Task runs it. For the following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n")),(0,i.kt)("p",null,"Normally this will be printed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'echo "Print something"\nPrint something\n')),(0,i.kt)("p",null,"With silent mode on, the below will be printed instead:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"Print something\n")),(0,i.kt)("p",null,"There are four ways to enable silent mode:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"At command level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - cmd: echo \"Print something\"\n silent: true\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"At task level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n silent: true\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Globally at Taskfile level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nsilent: true\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Or globally with ",(0,i.kt)("inlineCode",{parentName:"li"},"--silent")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"-s")," flag")),(0,i.kt)("p",null,"If you want to suppress STDOUT instead, just redirect a command to ",(0,i.kt)("inlineCode",{parentName:"p"},"/dev/null"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"This will print nothing\" > /dev/null\n")),(0,i.kt)("h2",{id:"dry-run-mode"},"Dry run mode"),(0,i.kt)("p",null,"Dry run mode (",(0,i.kt)("inlineCode",{parentName:"p"},"--dry"),") compiles and steps through each task, printing the commands that would be run without executing them. This is useful for debugging your Taskfiles."),(0,i.kt)("h2",{id:"ignore-errors"},"Ignore errors"),(0,i.kt)("p",null,"You have the option to ignore errors during command execution. Given the following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - exit 1\n - echo \"Hello World\"\n")),(0,i.kt)("p",null,"Task will abort the execution after running ",(0,i.kt)("inlineCode",{parentName:"p"},"exit 1")," because the status code ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"EXIT_FAILURE"),". However, it is possible to continue with execution using ",(0,i.kt)("inlineCode",{parentName:"p"},"ignore_error"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - cmd: exit 1\n ignore_error: true\n - echo \"Hello World\"\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"ignore_error")," can also be set for a task, which means errors will be suppressed for all commands. Nevertheless, keep in mind that this option will not propagate to other tasks called either by ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds"),"!"),(0,i.kt)("h2",{id:"output-syntax"},"Output syntax"),(0,i.kt)("p",null,"By default, Task just redirects the STDOUT and STDERR of the running commands to the shell in real-time. This is good for having live feedback for logging printed by commands, but the output can become messy if you have multiple commands running simultaneously and printing lots of stuff."),(0,i.kt)("p",null,"To make this more customizable, there are currently three different output options you can choose:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"interleaved")," (default)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"group")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"prefixed"))),(0,i.kt)("p",null,"To choose another one, just set it to root in the Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput: 'group'\n\ntasks:\n # ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output will print the entire output of a command once after it finishes, so you will not have live feedback for commands that take a long time to run."),(0,i.kt)("p",null,"When using the ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output, you can optionally provide a templated message to print at the start and end of the group. This can be useful for instructing CI systems to group all of the output for a given task, such as with ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#grouping-log-lines"},"GitHub Actions' ",(0,i.kt)("inlineCode",{parentName:"a"},"::group::")," command")," or ",(0,i.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?expand=1&view=azure-devops&tabs=bash#formatting-commands"},"Azure Pipelines"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput:\n group:\n begin: '::group::{{.TASK}}'\n end: '::endgroup::'\n\ntasks:\n default:\n cmds:\n - echo 'Hello, World!'\n silent: true\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task default\n::group::default\nHello, World!\n::endgroup::\n")),(0,i.kt)("p",null,"When using the ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output, you may swallow the output of the executed command on standard output and standard error if it does not fail (zero exit code)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nsilent: true\n\noutput:\n group:\n error_only: true\n\ntasks:\n passes: echo 'output-of-passes'\n errors: echo 'output-of-errors' && exit 1\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'$ task passes\n$ task errors\noutput-of-errors\ntask: Failed to run task "errors": exit status 1\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"prefix")," output will prefix every line printed by a command with ",(0,i.kt)("inlineCode",{parentName:"p"},"[task-name]")," as the prefix, but you can customize the prefix for a command with the ",(0,i.kt)("inlineCode",{parentName:"p"},"prefix:")," attribute:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput: prefixed\n\ntasks:\n default:\n deps:\n - task: print\n vars: { TEXT: foo }\n - task: print\n vars: { TEXT: bar }\n - task: print\n vars: { TEXT: baz }\n\n print:\n cmds:\n - echo \"{{.TEXT}}\"\n prefix: 'print-{{.TEXT}}'\n silent: true\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task default\n[print-foo] foo\n[print-bar] bar\n[print-baz] baz\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"output")," option can also be specified by the ",(0,i.kt)("inlineCode",{parentName:"p"},"--output")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-o")," flags.")),(0,i.kt)("h2",{id:"interactive-cli-application"},"Interactive CLI application"),(0,i.kt)("p",null,"When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the ",(0,i.kt)("a",{parentName:"p",href:"#output-syntax"},"output mode")," is set to something other than ",(0,i.kt)("inlineCode",{parentName:"p"},"interleaved")," (the default), or when interactive apps are run in parallel with other tasks."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"interactive: true")," tells Task this is an interactive application and Task will try to optimize for it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - vim my-file.txt\n interactive: true\n")),(0,i.kt)("p",null,"If you still have problems running an interactive app through Task, please open an issue about it."),(0,i.kt)("h2",{id:"short-task-syntax"},"Short task syntax"),(0,i.kt)("p",null,"Starting on Task v3, you can now write tasks with a shorter syntax if they have the default settings (e.g. no custom ",(0,i.kt)("inlineCode",{parentName:"p"},"env:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"vars:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"desc:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"silent:")," , etc):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build: go build -v -o ./app{{exeExt}} .\n\n run:\n - task: build\n - ./app{{exeExt}} -h localhost -p 8080\n")),(0,i.kt)("h2",{id:"set-and-shopt"},(0,i.kt)("inlineCode",{parentName:"h2"},"set")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"shopt")),(0,i.kt)("p",null,"It's possible to specify options to the ",(0,i.kt)("a",{parentName:"p",href:"https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html"},(0,i.kt)("inlineCode",{parentName:"a"},"set"))," and ",(0,i.kt)("a",{parentName:"p",href:"https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html"},(0,i.kt)("inlineCode",{parentName:"a"},"shopt"))," builtins. This can be added at global, task or command level."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nset: [pipefail]\nshopt: [globstar]\n\ntasks:\n # `globstar` required for double star globs to work\n default: echo **/*.go\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Keep in mind that not all options are available in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/mvdan/sh"},"shell interpreter library")," that Task uses.")),(0,i.kt)("h2",{id:"watch-tasks"},"Watch tasks"),(0,i.kt)("p",null,"With the flags ",(0,i.kt)("inlineCode",{parentName:"p"},"--watch")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-w")," task will watch for file changes and run the task again. This requires the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," attribute to be given, so task knows which files to watch."),(0,i.kt)("p",null,"The default watch interval is 5 seconds, but it's possible to change it by either setting ",(0,i.kt)("inlineCode",{parentName:"p"},"interval: '500ms'")," in the root of the Taskfile passing it as an argument like ",(0,i.kt)("inlineCode",{parentName:"p"},"--interval=500ms"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/b9256968.a17fa1ee.js b/pt-BR/assets/js/b9256968.a17fa1ee.js deleted file mode 100644 index 56abd22a..00000000 --- a/pt-BR/assets/js/b9256968.a17fa1ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[629],{3905:function(e,n,t){t.d(n,{Zo:function(){return d},kt:function(){return k}});var a=t(7294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var r=a.createContext({}),p=function(e){var n=a.useContext(r),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},d=function(e){var n=p(e.components);return a.createElement(r.Provider,{value:n},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,l=e.originalType,r=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),u=p(t),c=i,k=u["".concat(r,".").concat(c)]||u[c]||m[c]||l;return t?a.createElement(k,s(s({ref:n},d),{},{components:t})):a.createElement(k,s({ref:n},d))}));function k(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var l=t.length,s=new Array(l);s[0]=c;var o={};for(var r in n)hasOwnProperty.call(n,r)&&(o[r]=n[r]);o.originalType=e,o[u]="string"==typeof e?e:i,s[1]=o;for(var p=2;pdefer",id:"doing-task-cleanup-with-defer",level:2},{value:"Go's template engine",id:"gos-template-engine",level:2},{value:"Help",id:"help",level:2},{value:"Display summary of task",id:"display-summary-of-task",level:2},{value:"Task aliases",id:"task-aliases",level:2},{value:"Overriding task name",id:"overriding-task-name",level:2},{value:"Silent mode",id:"silent-mode",level:2},{value:"Dry run mode",id:"dry-run-mode",level:2},{value:"Ignore errors",id:"ignore-errors",level:2},{value:"Output syntax",id:"output-syntax",level:2},{value:"Interactive CLI application",id:"interactive-cli-application",level:2},{value:"Short task syntax",id:"short-task-syntax",level:2},{value:"set and shopt",id:"set-and-shopt",level:2},{value:"Watch tasks",id:"watch-tasks",level:2}],d={toc:p};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"guia-de-uso"},"Guia de Uso"),(0,i.kt)("h2",{id:"primeiros-passos"},"Primeiros passos"),(0,i.kt)("p",null,"Create a file called ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," in the root of your project. The ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds")," attribute should contain the commands of a task. The example below allows compiling a Go app and uses ",(0,i.kt)("a",{parentName:"p",href:"https://esbuild.github.io/"},"esbuild")," to concat and minify multiple CSS files into a single one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build -v -i main.go\n\n assets:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"Running the tasks is as simple as running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"task assets build\n")),(0,i.kt)("p",null,"Task uses ",(0,i.kt)("a",{parentName:"p",href:"https://mvdan.cc/sh/"},"mvdan.cc/sh"),", a native Go sh interpreter. So you can write sh/bash commands, and it will work even on Windows, where ",(0,i.kt)("inlineCode",{parentName:"p"},"sh")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"bash")," are usually not available. Just remember any executable called must be available by the OS or in PATH."),(0,i.kt)("p",null,'If you omit a task name, "default" will be assumed.'),(0,i.kt)("h2",{id:"supported-file-names"},"Supported file names"),(0,i.kt)("p",null,"Task will look for the following file names, in order of priority:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Taskfile.yml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.yaml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.dist.yml"),(0,i.kt)("li",{parentName:"ul"},"Taskfile.dist.yaml")),(0,i.kt)("p",null,"The intention of having the ",(0,i.kt)("inlineCode",{parentName:"p"},".dist")," variants is to allow projects to have one committed version (",(0,i.kt)("inlineCode",{parentName:"p"},".dist"),") while still allowing individual users to override the Taskfile by adding an additional ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," (which would be on ",(0,i.kt)("inlineCode",{parentName:"p"},".gitignore"),")."),(0,i.kt)("h3",{id:"running-a-taskfile-from-a-subdirectory"},"Running a Taskfile from a subdirectory"),(0,i.kt)("p",null,"If a Taskfile cannot be found in the current working directory, it will walk up the file tree until it finds one (similar to how ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," works). When running Task from a subdirectory like this, it will behave as if you ran it from the directory containing the Taskfile."),(0,i.kt)("p",null,"You can use this functionality along with the special ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.USER_WORKING_DIR}}")," variable to create some very useful reusable tasks. For example, if you have a monorepo with directories for each microservice, you can ",(0,i.kt)("inlineCode",{parentName:"p"},"cd")," into a microservice directory and run a task command to bring it up without having to create multiple tasks or Taskfiles with identical content. For example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n up:\n dir: '{{.USER_WORKING_DIR}}'\n preconditions:\n - test -f docker-compose.yml\n cmds:\n - docker-compose up -d\n")),(0,i.kt)("p",null,"In this example, we can run ",(0,i.kt)("inlineCode",{parentName:"p"},"cd ")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"task up")," and as long as the ",(0,i.kt)("inlineCode",{parentName:"p"},"")," directory contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"docker-compose.yml"),", the Docker composition will be brought up."),(0,i.kt)("h3",{id:"running-a-global-taskfile"},"Running a global Taskfile"),(0,i.kt)("p",null,"If you call Task with the ",(0,i.kt)("inlineCode",{parentName:"p"},"--global")," (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-g"),") flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile on either ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME/Taskfile.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME/Taskfile.yaml")," paths."),(0,i.kt)("p",null,"This is useful to have automation that you can run from anywhere in your system!"),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"When running your global Taskfile with ",(0,i.kt)("inlineCode",{parentName:"p"},"-g"),", tasks will run on ",(0,i.kt)("inlineCode",{parentName:"p"},"$HOME")," by default, and not on your working directory!"),(0,i.kt)("p",{parentName:"admonition"},"As mentioned in the previous section, the ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.USER_WORKING_DIR}}")," special variable can be very handy here to run stuff on the directory you're calling ",(0,i.kt)("inlineCode",{parentName:"p"},"task -g")," from."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n from-home:\n cmds:\n - pwd\n\n from-working-directory:\n dir: '{{.USER_WORKING_DIR}}'\n cmds:\n - pwd\n"))),(0,i.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,i.kt)("h3",{id:"task"},"Task"),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"env")," to set custom environment variables for a specific task:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n greet:\n cmds:\n - echo $GREETING\n env:\n GREETING: Hey, there!\n")),(0,i.kt)("p",null,"Additionally, you can set global environment variables that will be available to all tasks:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n GREETING: Hey, there!\n\ntasks:\n greet:\n cmds:\n - echo $GREETING\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("inlineCode",{parentName:"p"},"env")," supports expansion and retrieving output from a shell command just like variables, as you can see in the ",(0,i.kt)("a",{parentName:"p",href:"#variables"},"Variables")," section.")),(0,i.kt)("h3",{id:"env-files"},".env files"),(0,i.kt)("p",null,"You can also ask Task to include ",(0,i.kt)("inlineCode",{parentName:"p"},".env")," like files by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"dotenv:")," setting:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title=".env"',title:'".env"'},"KEYNAME=VALUE\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash",metastring:'title="testing/.env"',title:'"testing/.env"'},"ENDPOINT=testing.com\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Taskfile.yml"',title:'"Taskfile.yml"'},"version: '3'\n\nenv:\n ENV: testing\n\ndotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n\ntasks:\n greet:\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("p",null,"Dotenv files can also be specified at the task level:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n ENV: testing\n\ntasks:\n greet:\n dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("p",null,"Environment variables specified explicitly at the task-level will override variables defined in dotfiles:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nenv:\n ENV: testing\n\ntasks:\n greet:\n dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']\n env:\n KEYNAME: DIFFERENT_VALUE\n cmds:\n - echo \"Using $KEYNAME and endpoint $ENDPOINT\"\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note that you are not currently able to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"dotenv")," key inside included Taskfiles.")),(0,i.kt)("h2",{id:"including-other-taskfiles"},"Including other Taskfiles"),(0,i.kt)("p",null,"If you want to share tasks between different projects (Taskfiles), you can use the importing mechanism to include other Taskfiles using the ",(0,i.kt)("inlineCode",{parentName:"p"},"includes")," keyword:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n docs: ./documentation # will look for ./documentation/Taskfile.yml\n docker: ./DockerTasks.yml\n")),(0,i.kt)("p",null,"The tasks described in the given Taskfiles will be available with the informed namespace. So, you'd call ",(0,i.kt)("inlineCode",{parentName:"p"},"task docs:serve")," to run the ",(0,i.kt)("inlineCode",{parentName:"p"},"serve")," task from ",(0,i.kt)("inlineCode",{parentName:"p"},"documentation/Taskfile.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"task docker:build")," to run the ",(0,i.kt)("inlineCode",{parentName:"p"},"build")," task from the ",(0,i.kt)("inlineCode",{parentName:"p"},"DockerTasks.yml")," file."),(0,i.kt)("p",null,"Relative paths are resolved relative to the directory containing the including Taskfile."),(0,i.kt)("h3",{id:"os-specific-taskfiles"},"OS-specific Taskfiles"),(0,i.kt)("p",null,"With ",(0,i.kt)("inlineCode",{parentName:"p"},"version: '2'"),", task automatically includes any ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_{{OS}}.yml")," if it exists (for example: ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_windows.yml"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_linux.yml")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile_darwin.yml"),"). Since this behavior was a bit too implicit, it was removed on version 3, but you still can have a similar behavior by explicitly importing these files:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n build: ./Taskfile_{{OS}}.yml\n")),(0,i.kt)("h3",{id:"directory-of-included-taskfile"},"Directory of included Taskfile"),(0,i.kt)("p",null,"By default, included Taskfile's tasks are run in the current directory, even if the Taskfile is in another directory, but you can force its tasks to run in another directory by using this alternative syntax:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n docs:\n taskfile: ./docs/Taskfile.yml\n dir: ./docs\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"The included Taskfiles must be using the same schema version as the main Taskfile uses.")),(0,i.kt)("h3",{id:"optional-includes"},"Optional includes"),(0,i.kt)("p",null,"Includes marked as optional will allow Task to continue execution as normal if the included file is missing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n tests:\n taskfile: ./tests/Taskfile.yml\n optional: true\n\ntasks:\n greet:\n cmds:\n - echo \"This command can still be successfully executed if\n ./tests/Taskfile.yml does not exist\"\n")),(0,i.kt)("h3",{id:"internal-includes"},"Internal includes"),(0,i.kt)("p",null,"Includes marked as internal will set all the tasks of the included file to be internal as well (see the ",(0,i.kt)("a",{parentName:"p",href:"#internal-tasks"},"Internal tasks")," section below). This is useful when including utility tasks that are not intended to be used directly by the user."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n tests:\n taskfile: ./taskfiles/Utils.yml\n internal: true\n")),(0,i.kt)("h3",{id:"vars-of-included-taskfiles"},"Vars of included Taskfiles"),(0,i.kt)("p",null,"You can also specify variables when including a Taskfile. This may be useful for having reusable Taskfile that can be tweaked or even included more than once:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n backend:\n taskfile: ./taskfiles/Docker.yml\n vars:\n DOCKER_IMAGE: backend_image\n\n frontend:\n taskfile: ./taskfiles/Docker.yml\n vars:\n DOCKER_IMAGE: frontend_image\n")),(0,i.kt)("h3",{id:"namespace-aliases"},"Namespace aliases"),(0,i.kt)("p",null,"When including a Taskfile, you can give the namespace a list of ",(0,i.kt)("inlineCode",{parentName:"p"},"aliases"),". This works in the same way as ",(0,i.kt)("a",{parentName:"p",href:"#task-aliases"},"task aliases")," and can be used together to create shorter and easier-to-type commands."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nincludes:\n generate:\n taskfile: ./taskfiles/Generate.yml\n aliases: [gen]\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"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 ",(0,i.kt)("a",{parentName:"p",href:"https://go-task.github.io/slim-sprig/defaults.html"},"default function"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"MY_VAR: '{{.MY_VAR | default \"my-default-value\"}}'"),".")),(0,i.kt)("h2",{id:"internal-tasks"},"Internal tasks"),(0,i.kt)("p",null,"Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-image-1:\n cmds:\n - task: build-image\n vars:\n DOCKER_IMAGE: image-1\n\n build-image:\n internal: true\n cmds:\n - docker build -t {{.DOCKER_IMAGE}} .\n")),(0,i.kt)("h2",{id:"task-directory"},"Task directory"),(0,i.kt)("p",null,"By default, tasks will be executed in the directory where the Taskfile is located. But you can easily make the task run in another folder, informing ",(0,i.kt)("inlineCode",{parentName:"p"},"dir"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n serve:\n dir: public/www\n cmds:\n # run http server\n - caddy\n")),(0,i.kt)("p",null,"If the directory does not exist, ",(0,i.kt)("inlineCode",{parentName:"p"},"task")," creates it."),(0,i.kt)("h2",{id:"task-dependencies"},"Task dependencies"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Dependencies run in parallel, so dependencies of a task should not depend one another. If you want to force tasks to run serially, take a look at the ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"Calling Another Task")," section below.")),(0,i.kt)("p",null,"You may have tasks that depend on others. Just pointing them on ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," will make them run automatically before running the parent task:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n deps: [assets]\n cmds:\n - go build -v -i main.go\n\n assets:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"In the above example, ",(0,i.kt)("inlineCode",{parentName:"p"},"assets")," will always run right before ",(0,i.kt)("inlineCode",{parentName:"p"},"build")," if you run ",(0,i.kt)("inlineCode",{parentName:"p"},"task build"),"."),(0,i.kt)("p",null,"A task can have only dependencies and no commands to group tasks together:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n assets:\n deps: [js, css]\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"If there is more than one dependency, they always run in parallel for better performance."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"You can also make the tasks given by the command line run in parallel by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"--parallel")," flag (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-p"),"). Example: ",(0,i.kt)("inlineCode",{parentName:"p"},"task --parallel js css"),".")),(0,i.kt)("p",null,"If you want to pass information to dependencies, you can do that the same manner as you would to ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"call another task"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n deps:\n - task: echo_sth\n vars: { TEXT: 'before 1' }\n - task: echo_sth\n vars: { TEXT: 'before 2' }\n silent: true\n cmds:\n - echo \"after\"\n\n echo_sth:\n cmds:\n - echo {{.TEXT}}\n")),(0,i.kt)("h2",{id:"platform-specific-tasks-and-commands"},"Platform specific tasks and commands"),(0,i.kt)("p",null,"If you want to restrict the running of tasks to explicit platforms, this can be achieved using the ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("p",null,"The values allowed as OS or Arch are valid ",(0,i.kt)("inlineCode",{parentName:"p"},"GOOS")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"GOARCH")," values, as defined by the Go language ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/golang/go/blob/master/src/go/build/syslist.go"},"here"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"build-windows")," task below will run only on Windows, and on any architecture:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-windows:\n platforms: [windows]\n cmds:\n - echo 'Running command on Windows'\n")),(0,i.kt)("p",null,"This can be restricted to a specific architecture as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-windows-amd64:\n platforms: [windows/amd64]\n cmds:\n - echo 'Running command on Windows (amd64)'\n")),(0,i.kt)("p",null,"It is also possible to restrict the task to specific architectures:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build-amd64:\n platforms: [amd64]\n cmds:\n - echo 'Running command on amd64'\n")),(0,i.kt)("p",null,"Multiple platforms can be specified as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n platforms: [windows/amd64, darwin]\n cmds:\n - echo 'Running command on Windows (amd64) and macOS'\n")),(0,i.kt)("p",null,"Individual commands can also be restricted to specific platforms:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - cmd: echo 'Running command on Windows (amd64) and macOS'\n platforms: [windows/amd64, darwin]\n - cmd: echo 'Running on all platforms'\n")),(0,i.kt)("h2",{id:"calling-another-task"},"Calling another task"),(0,i.kt)("p",null,"When a task has many dependencies, they are executed concurrently. This will often result in a faster build pipeline. However, in some situations, you may need to call other tasks serially. In this case, use the following syntax:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'version: \'3\'\n\ntasks:\n main-task:\n cmds:\n - task: task-to-be-called\n - task: another-task\n - echo "Both done"\n\n task-to-be-called:\n cmds:\n - echo "Task to be called"\n\n another-task:\n cmds:\n - echo "Another task"\n')),(0,i.kt)("p",null,"Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"vars")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"silent")," attributes you can choose to pass variables and toggle ",(0,i.kt)("a",{parentName:"p",href:"#silent-mode"},"silent mode")," on a call-by-call basis:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n greet:\n vars:\n RECIPIENT: '{{default \"World\" .RECIPIENT}}'\n cmds:\n - echo \"Hello, {{.RECIPIENT}}!\"\n\n greet-pessimistically:\n cmds:\n - task: greet\n vars: { RECIPIENT: 'Cruel World' }\n silent: true\n")),(0,i.kt)("p",null,"The above syntax is also supported in ",(0,i.kt)("inlineCode",{parentName:"p"},"deps"),"."),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"NOTE: If you want to call a task declared in the root Taskfile from within an ",(0,i.kt)("a",{parentName:"p",href:"#including-other-taskfiles"},"included Taskfile"),", add a leading ",(0,i.kt)("inlineCode",{parentName:"p"},":")," like this: ",(0,i.kt)("inlineCode",{parentName:"p"},"task: :task-name"),".")),(0,i.kt)("h2",{id:"prevent-unnecessary-work"},"Prevent unnecessary work"),(0,i.kt)("h3",{id:"by-fingerprinting-locally-generated-files-and-their-sources"},"By fingerprinting locally generated files and their sources"),(0,i.kt)("p",null,"If a task generates something, you can inform Task the source and generated files, so Task will prevent running them if not necessary."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n deps: [js, css]\n cmds:\n - go build -v -i main.go\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n sources:\n - src/js/**/*.js\n generates:\n - public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n sources:\n - src/css/**/*.css\n generates:\n - public/bundle.css\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"sources")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"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 ",(0,i.kt)("inlineCode",{parentName:"p"},'Task "js" is up to date'),"."),(0,i.kt)("p",null,"If you prefer this check to be made by the modification timestamp of the files, instead of its checksum (content), just set the ",(0,i.kt)("inlineCode",{parentName:"p"},"method")," property to ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build .\n sources:\n - ./*.go\n generates:\n - app{{exeExt}}\n method: timestamp\n")),(0,i.kt)("p",null,"In situations where you need more flexibility the ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," keyword can be used. You can even combine the two. See the documentation for ",(0,i.kt)("a",{parentName:"p",href:"#using-programmatic-checks-to-indicate-a-task-is-up-to-date"},"status")," for an example."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"By default, task stores checksums on a local ",(0,i.kt)("inlineCode",{parentName:"p"},".task")," directory in the project's directory. Most of the time, you'll want to have this directory on ",(0,i.kt)("inlineCode",{parentName:"p"},".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)."),(0,i.kt)("p",{parentName:"admonition"},"If you want these files to be stored in another directory, you can set a ",(0,i.kt)("inlineCode",{parentName:"p"},"TASK_TEMP_DIR")," environment variable in your machine. It can contain a relative path like ",(0,i.kt)("inlineCode",{parentName:"p"},"tmp/task")," that will be interpreted as relative to the project directory, or an absolute or home path like ",(0,i.kt)("inlineCode",{parentName:"p"},"/tmp/.task")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.task")," (subdirectories will be created for each project)."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"export TASK_TEMP_DIR='~/.task'\n"))),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Each task has only one checksum stored for its ",(0,i.kt)("inlineCode",{parentName:"p"},"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."),(0,i.kt)("p",{parentName:"admonition"},"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.")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The method ",(0,i.kt)("inlineCode",{parentName:"p"},"none")," skips any validation and always run the task.")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"checksum")," (default) or ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp")," method to work, it is only necessary to inform the source files. When the ",(0,i.kt)("inlineCode",{parentName:"p"},"timestamp")," method is used, the last time of the running the task is considered as a generate.")),(0,i.kt)("h3",{id:"using-programmatic-checks-to-indicate-a-task-is-up-to-date"},"Using programmatic checks to indicate a task is up to date"),(0,i.kt)("p",null,"Alternatively, you can inform a sequence of tests as ",(0,i.kt)("inlineCode",{parentName:"p"},"status"),". If no error is returned (exit status 0), the task is considered up-to-date:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate-files:\n cmds:\n - mkdir directory\n - touch directory/file1.txt\n - touch directory/file2.txt\n # test existence of files\n status:\n - test -d directory\n - test -f directory/file1.txt\n - test -f directory/file2.txt\n")),(0,i.kt)("p",null,"Normally, you would use ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"generates")," - but for tasks that generate remote artifacts (Docker images, deploys, CD releases) the checksum source and timestamps require either access to the artifact or for an out-of-band refresh of the ",(0,i.kt)("inlineCode",{parentName:"p"},".checksum")," fingerprint file."),(0,i.kt)("p",null,"Two special variables ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.CHECKSUM}}")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.TIMESTAMP}}")," are available for interpolation within ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," commands, depending on the method assigned to fingerprint the sources. Only ",(0,i.kt)("inlineCode",{parentName:"p"},"source")," globs are fingerprinted."),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"{{.TIMESTAMP}}"),' variable is a "live" Go ',(0,i.kt)("inlineCode",{parentName:"p"},"time.Time")," struct, and can be formatted using any of the methods that ",(0,i.kt)("inlineCode",{parentName:"p"},"time.Time")," responds to."),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"https://golang.org/pkg/time/"},"the Go Time documentation")," for more information."),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"--force")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-f")," if you want to force a task to run even when up-to-date."),(0,i.kt)("p",null,"Also, ",(0,i.kt)("inlineCode",{parentName:"p"},"task --status [tasks]...")," will exit with a non-zero exit code if any of the tasks are not up-to-date."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"status")," can be combined with the ",(0,i.kt)("a",{parentName:"p",href:"#by-fingerprinting-locally-generated-files-and-their-sources"},"fingerprinting")," to have a task run if either the the source/generated artifacts changes, or the programmatic check fails:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:prod:\n desc: Build for production usage.\n cmds:\n - composer install\n # Run this task if source files changes.\n sources:\n - composer.json\n - composer.lock\n generates:\n - ./vendor/composer/installed.json\n - ./vendor/autoload.php\n # But also run the task if the last build was not a production build.\n status:\n - grep -q '\"dev\": false' ./vendor/composer/installed.json\n")),(0,i.kt)("h3",{id:"using-programmatic-checks-to-cancel-the-execution-of-a-task-and-its-dependencies"},"Using programmatic checks to cancel the execution of a task and its dependencies"),(0,i.kt)("p",null,"In addition to ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," checks, ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," checks are the logical inverse of ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," checks. That is, if you need a certain set of conditions to be ",(0,i.kt)("em",{parentName:"p"},"true")," you can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," stanza. ",(0,i.kt)("inlineCode",{parentName:"p"},"preconditions")," are similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"status")," lines, except they support ",(0,i.kt)("inlineCode",{parentName:"p"},"sh")," expansion, and they SHOULD all return 0."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate-files:\n cmds:\n - mkdir directory\n - touch directory/file1.txt\n - touch directory/file2.txt\n # test existence of files\n preconditions:\n - test -f .env\n - sh: '[ 1 = 0 ]'\n msg: \"One doesn't equal Zero, Halting\"\n")),(0,i.kt)("p",null,"Preconditions can set specific failure messages that can tell a user what steps to take using the ",(0,i.kt)("inlineCode",{parentName:"p"},"msg")," field."),(0,i.kt)("p",null,"If a task has a dependency on a sub-task with a precondition, and that precondition is not met - the calling task will fail. Note that a task executed with a failing precondition will not run unless ",(0,i.kt)("inlineCode",{parentName:"p"},"--force")," is given."),(0,i.kt)("p",null,"Unlike ",(0,i.kt)("inlineCode",{parentName:"p"},"status"),", which will skip a task if it is up to date and continue executing tasks that depend on it, a ",(0,i.kt)("inlineCode",{parentName:"p"},"precondition")," will fail a task, along with any other tasks that depend on it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n task-will-fail:\n preconditions:\n - sh: 'exit 1'\n\n task-will-also-fail:\n deps:\n - task-will-fail\n\n task-will-still-fail:\n cmds:\n - task: task-will-fail\n - echo \"I will not run\"\n")),(0,i.kt)("h3",{id:"limiting-when-tasks-run"},"Limiting when tasks run"),(0,i.kt)("p",null,"If a task executed by multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds")," or multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," you can control when it is executed using ",(0,i.kt)("inlineCode",{parentName:"p"},"run"),". ",(0,i.kt)("inlineCode",{parentName:"p"},"run")," can also be set at the root of the Taskfile to change the behavior of all the tasks unless explicitly overridden."),(0,i.kt)("p",null,"Supported values for ",(0,i.kt)("inlineCode",{parentName:"p"},"run"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"always")," (default) always attempt to invoke the task regardless of the number of previous executions"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"once")," only invoke this task once regardless of the number of references"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"when_changed")," only invokes the task once for each unique set of variables passed into the task")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - task: generate-file\n vars: { CONTENT: '1' }\n - task: generate-file\n vars: { CONTENT: '2' }\n - task: generate-file\n vars: { CONTENT: '2' }\n\n generate-file:\n run: when_changed\n deps:\n - install-deps\n cmds:\n - echo {{.CONTENT}}\n\n install-deps:\n run: once\n cmds:\n - sleep 5 # long operation like installing packages\n")),(0,i.kt)("h2",{id:"variables"},"Variables"),(0,i.kt)("p",null,"When doing interpolation of variables, Task will look for the below. They are listed below in order of importance (i.e. most important first):"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Variables declared in the task definition"),(0,i.kt)("li",{parentName:"ul"},"Variables given while calling a task from another (See ",(0,i.kt)("a",{parentName:"li",href:"#calling-another-task"},"Calling another task")," above)"),(0,i.kt)("li",{parentName:"ul"},"Variables of the ",(0,i.kt)("a",{parentName:"li",href:"#including-other-taskfiles"},"included Taskfile")," (when the task is included)"),(0,i.kt)("li",{parentName:"ul"},"Variables of the ",(0,i.kt)("a",{parentName:"li",href:"#vars-of-included-taskfiles"},"inclusion of the Taskfile")," (when the task is included)"),(0,i.kt)("li",{parentName:"ul"},"Global variables (those declared in the ",(0,i.kt)("inlineCode",{parentName:"li"},"vars:")," option in the Taskfile)"),(0,i.kt)("li",{parentName:"ul"},"Environment variables")),(0,i.kt)("p",null,"Example of sending parameters with environment variables:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ TASK_VARIABLE=a-value task do-something\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"A special variable ",(0,i.kt)("inlineCode",{parentName:"p"},".TASK")," is always available containing the task name.")),(0,i.kt)("p",null,"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."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'$ task write-file FILE=file.txt "CONTENT=Hello, World!" print "MESSAGE=All done!"\n')),(0,i.kt)("p",null,"Example of locally declared vars:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-var:\n cmds:\n - echo \"{{.VAR}}\"\n vars:\n VAR: Hello!\n")),(0,i.kt)("p",null,"Example of global vars in a ",(0,i.kt)("inlineCode",{parentName:"p"},"Taskfile.yml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nvars:\n GREETING: Hello from Taskfile!\n\ntasks:\n greet:\n cmds:\n - echo \"{{.GREETING}}\"\n")),(0,i.kt)("h3",{id:"dynamic-variables"},"Dynamic variables"),(0,i.kt)("p",null,"The below syntax (",(0,i.kt)("inlineCode",{parentName:"p"},"sh:")," prop in a variable) is considered a dynamic variable. The value will be treated as a command and the output assigned. If there are one or more trailing newlines, the last newline will be trimmed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n cmds:\n - go build -ldflags=\"-X main.Version={{.GIT_COMMIT}}\" main.go\n vars:\n GIT_COMMIT:\n sh: git log -n 1 --format=%h\n")),(0,i.kt)("p",null,"This works for all types of variables."),(0,i.kt)("h2",{id:"forwarding-cli-arguments-to-commands"},"Forwarding CLI arguments to commands"),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"--")," is given in the CLI, all following parameters are added to a special ",(0,i.kt)("inlineCode",{parentName:"p"},".CLI_ARGS")," variable. This is useful to forward arguments to another command."),(0,i.kt)("p",null,"The below example will run ",(0,i.kt)("inlineCode",{parentName:"p"},"yarn install"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task yarn -- install\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n yarn:\n cmds:\n - yarn {{.CLI_ARGS}}\n")),(0,i.kt)("h2",{id:"doing-task-cleanup-with-defer"},"Doing task cleanup with ",(0,i.kt)("inlineCode",{parentName:"h2"},"defer")),(0,i.kt)("p",null,"With the ",(0,i.kt)("inlineCode",{parentName:"p"},"defer")," keyword, it's possible to schedule cleanup to be run once the task finishes. The difference with just putting it as the last command is that this command will run even when the task fails."),(0,i.kt)("p",null,"In the example below, ",(0,i.kt)("inlineCode",{parentName:"p"},"rm -rf tmpdir/")," will run even if the third command fails:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - mkdir -p tmpdir/\n - defer: rm -rf tmpdir/\n - echo 'Do work on tmpdir/'\n")),(0,i.kt)("p",null,"If you want to move the cleanup command into another task, that is possible as well:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - mkdir -p tmpdir/\n - defer: { task: cleanup }\n - echo 'Do work on tmpdir/'\n\n cleanup: rm -rf tmpdir/\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Due to the nature of how the ",(0,i.kt)("a",{parentName:"p",href:"https://go.dev/tour/flowcontrol/13"},"Go's own ",(0,i.kt)("inlineCode",{parentName:"a"},"defer")," work"),", the deferred commands are executed in the reverse order if you schedule multiple of them.")),(0,i.kt)("h2",{id:"gos-template-engine"},"Go's template engine"),(0,i.kt)("p",null,"Task parse commands as ",(0,i.kt)("a",{parentName:"p",href:"https://golang.org/pkg/text/template/"},"Go's template engine")," before executing them. Variables are accessible through dot syntax (",(0,i.kt)("inlineCode",{parentName:"p"},".VARNAME"),")."),(0,i.kt)("p",null,"All functions by the Go's ",(0,i.kt)("a",{parentName:"p",href:"https://go-task.github.io/slim-sprig/"},"slim-sprig lib")," are available. The following example gets the current date in a given format:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-date:\n cmds:\n - echo {{now | date \"2006-01-02\"}}\n")),(0,i.kt)("p",null,"Task also adds the following functions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"OS"),': Returns the operating system. Possible values are "windows", "linux", "darwin" (macOS) and "freebsd".'),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ARCH"),': return the architecture Task was compiled to: "386", "amd64", "arm" or "s390x".'),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"splitLines"),": Splits Unix (\\n) and Windows (\\r\\n) styled newlines."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"catLines"),": Replaces Unix (\\n) and Windows (\\r\\n) styled newlines with a space."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"toSlash"),": Does nothing on Unix, but on Windows converts a string from ",(0,i.kt)("inlineCode",{parentName:"li"},"\\")," path format to ",(0,i.kt)("inlineCode",{parentName:"li"},"/"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"fromSlash"),": Opposite of ",(0,i.kt)("inlineCode",{parentName:"li"},"toSlash"),". Does nothing on Unix, but on Windows converts a string from ",(0,i.kt)("inlineCode",{parentName:"li"},"/")," path format to ",(0,i.kt)("inlineCode",{parentName:"li"},"\\"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"exeExt"),": Returns the right executable extension for the current OS (",(0,i.kt)("inlineCode",{parentName:"li"},'".exe"')," for Windows, ",(0,i.kt)("inlineCode",{parentName:"li"},'""')," for others)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"shellQuote"),": Quotes a string to make it safe for use in shell scripts. Task uses ",(0,i.kt)("a",{parentName:"li",href:"https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote"},"this Go function")," for this. The Bash dialect is assumed."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"splitArgs"),": Splits a string as if it were a command's arguments. Task uses ",(0,i.kt)("a",{parentName:"li",href:"https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/shell#Fields"},"this Go function"))),(0,i.kt)("p",null,"Example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n print-os:\n cmds:\n - echo '{{OS}} {{ARCH}}'\n - echo '{{if eq OS \"windows\"}}windows-command{{else}}unix-command{{end}}'\n # This will be path/to/file on Unix but path\\to\\file on Windows\n - echo '{{fromSlash \"path/to/file\"}}'\n enumerated-file:\n vars:\n CONTENT: |\n foo\n bar\n cmds:\n - |\n cat << EOF > output.txt\n {{range $i, $line := .CONTENT | splitLines -}}\n {{printf \"%3d\" $i}}: {{$line}}\n {{end}}EOF\n")),(0,i.kt)("h2",{id:"help"},"Help"),(0,i.kt)("p",null,"Running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --list")," (or ",(0,i.kt)("inlineCode",{parentName:"p"},"task -l"),") lists all tasks with a description. The following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build:\n desc: Build the go binary.\n cmds:\n - go build -v -i main.go\n\n test:\n desc: Run all the go tests.\n cmds:\n - go test -race ./...\n\n js:\n cmds:\n - esbuild --bundle --minify js/index.js > public/bundle.js\n\n css:\n cmds:\n - esbuild --bundle --minify css/index.css > public/bundle.css\n")),(0,i.kt)("p",null,"would print the following output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"* build: Build the go binary.\n* test: Run all the go tests.\n")),(0,i.kt)("p",null,"If you want to see all tasks, there's a ",(0,i.kt)("inlineCode",{parentName:"p"},"--list-all")," (alias ",(0,i.kt)("inlineCode",{parentName:"p"},"-a"),") flag as well."),(0,i.kt)("h2",{id:"display-summary-of-task"},"Display summary of task"),(0,i.kt)("p",null,"Running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --summary task-name")," will show a summary of a task. The following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n release:\n deps: [build]\n summary: |\n Release your project to github\n\n It will build your project before starting the release.\n Please make sure that you have set GITHUB_TOKEN before starting.\n cmds:\n - your-release-tool\n\n build:\n cmds:\n - your-build-tool\n")),(0,i.kt)("p",null,"with running ",(0,i.kt)("inlineCode",{parentName:"p"},"task --summary release")," would print the following output:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"task: release\n\nRelease your project to github\n\nIt will build your project before starting the release.\nPlease make sure that you have set GITHUB_TOKEN before starting.\n\ndependencies:\n - build\n\ncommands:\n - your-release-tool\n")),(0,i.kt)("p",null,"If a summary is missing, the description will be printed. If the task does not have a summary or a description, a warning is printed."),(0,i.kt)("p",null,"Please note: ",(0,i.kt)("em",{parentName:"p"},"showing the summary will not execute the command"),"."),(0,i.kt)("h2",{id:"task-aliases"},"Task aliases"),(0,i.kt)("p",null,"Aliases are alternative names for tasks. They can be used to make it easier and quicker to run tasks with long or hard-to-type names. You can use them on the command line, when ",(0,i.kt)("a",{parentName:"p",href:"#calling-another-task"},"calling sub-tasks")," in your Taskfile and when ",(0,i.kt)("a",{parentName:"p",href:"#including-other-taskfiles"},"including tasks")," with aliases from another Taskfile. They can also be used together with ",(0,i.kt)("a",{parentName:"p",href:"#namespace-aliases"},"namespace aliases"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n generate:\n aliases: [gen]\n cmds:\n - task: gen-mocks\n\n generate-mocks:\n aliases: [gen-mocks]\n cmds:\n - echo \"generating...\"\n")),(0,i.kt)("h2",{id:"overriding-task-name"},"Overriding task name"),(0,i.kt)("p",null,"Sometimes you may want to override the task name printed on the summary, up-to-date messages to STDOUT, etc. In this case, you can just set ",(0,i.kt)("inlineCode",{parentName:"p"},"label:"),", which can also be interpolated with variables:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n - task: print\n vars:\n MESSAGE: hello\n - task: print\n vars:\n MESSAGE: world\n\n print:\n label: 'print-{{.MESSAGE}}'\n cmds:\n - echo \"{{.MESSAGE}}\"\n")),(0,i.kt)("h2",{id:"silent-mode"},"Silent mode"),(0,i.kt)("p",null,"Silent mode disables the echoing of commands before Task runs it. For the following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n")),(0,i.kt)("p",null,"Normally this will be printed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'echo "Print something"\nPrint something\n')),(0,i.kt)("p",null,"With silent mode on, the below will be printed instead:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"Print something\n")),(0,i.kt)("p",null,"There are four ways to enable silent mode:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"At command level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - cmd: echo \"Print something\"\n silent: true\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"At task level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n silent: true\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Globally at Taskfile level:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nsilent: true\n\ntasks:\n echo:\n cmds:\n - echo \"Print something\"\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Or globally with ",(0,i.kt)("inlineCode",{parentName:"li"},"--silent")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"-s")," flag")),(0,i.kt)("p",null,"If you want to suppress STDOUT instead, just redirect a command to ",(0,i.kt)("inlineCode",{parentName:"p"},"/dev/null"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - echo \"This will print nothing\" > /dev/null\n")),(0,i.kt)("h2",{id:"dry-run-mode"},"Dry run mode"),(0,i.kt)("p",null,"Dry run mode (",(0,i.kt)("inlineCode",{parentName:"p"},"--dry"),") compiles and steps through each task, printing the commands that would be run without executing them. This is useful for debugging your Taskfiles."),(0,i.kt)("h2",{id:"ignore-errors"},"Ignore errors"),(0,i.kt)("p",null,"You have the option to ignore errors during command execution. Given the following Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - exit 1\n - echo \"Hello World\"\n")),(0,i.kt)("p",null,"Task will abort the execution after running ",(0,i.kt)("inlineCode",{parentName:"p"},"exit 1")," because the status code ",(0,i.kt)("inlineCode",{parentName:"p"},"1")," stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"EXIT_FAILURE"),". However, it is possible to continue with execution using ",(0,i.kt)("inlineCode",{parentName:"p"},"ignore_error"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n echo:\n cmds:\n - cmd: exit 1\n ignore_error: true\n - echo \"Hello World\"\n")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"ignore_error")," can also be set for a task, which means errors will be suppressed for all commands. Nevertheless, keep in mind that this option will not propagate to other tasks called either by ",(0,i.kt)("inlineCode",{parentName:"p"},"deps")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"cmds"),"!"),(0,i.kt)("h2",{id:"output-syntax"},"Output syntax"),(0,i.kt)("p",null,"By default, Task just redirects the STDOUT and STDERR of the running commands to the shell in real-time. This is good for having live feedback for logging printed by commands, but the output can become messy if you have multiple commands running simultaneously and printing lots of stuff."),(0,i.kt)("p",null,"To make this more customizable, there are currently three different output options you can choose:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"interleaved")," (default)"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"group")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"prefixed"))),(0,i.kt)("p",null,"To choose another one, just set it to root in the Taskfile:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput: 'group'\n\ntasks:\n # ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output will print the entire output of a command once after it finishes, so you will not have live feedback for commands that take a long time to run."),(0,i.kt)("p",null,"When using the ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output, you can optionally provide a templated message to print at the start and end of the group. This can be useful for instructing CI systems to group all of the output for a given task, such as with ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#grouping-log-lines"},"GitHub Actions' ",(0,i.kt)("inlineCode",{parentName:"a"},"::group::")," command")," or ",(0,i.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?expand=1&view=azure-devops&tabs=bash#formatting-commands"},"Azure Pipelines"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput:\n group:\n begin: '::group::{{.TASK}}'\n end: '::endgroup::'\n\ntasks:\n default:\n cmds:\n - echo 'Hello, World!'\n silent: true\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task default\n::group::default\nHello, World!\n::endgroup::\n")),(0,i.kt)("p",null,"When using the ",(0,i.kt)("inlineCode",{parentName:"p"},"group")," output, you may swallow the output of the executed command on standard output and standard error if it does not fail (zero exit code)."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nsilent: true\n\noutput:\n group:\n error_only: true\n\ntasks:\n passes: echo 'output-of-passes'\n errors: echo 'output-of-errors' && exit 1\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'$ task passes\n$ task errors\noutput-of-errors\ntask: Failed to run task "errors": exit status 1\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"prefix")," output will prefix every line printed by a command with ",(0,i.kt)("inlineCode",{parentName:"p"},"[task-name]")," as the prefix, but you can customize the prefix for a command with the ",(0,i.kt)("inlineCode",{parentName:"p"},"prefix:")," attribute:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\noutput: prefixed\n\ntasks:\n default:\n deps:\n - task: print\n vars: { TEXT: foo }\n - task: print\n vars: { TEXT: bar }\n - task: print\n vars: { TEXT: baz }\n\n print:\n cmds:\n - echo \"{{.TEXT}}\"\n prefix: 'print-{{.TEXT}}'\n silent: true\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"$ task default\n[print-foo] foo\n[print-bar] bar\n[print-baz] baz\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"output")," option can also be specified by the ",(0,i.kt)("inlineCode",{parentName:"p"},"--output")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-o")," flags.")),(0,i.kt)("h2",{id:"interactive-cli-application"},"Interactive CLI application"),(0,i.kt)("p",null,"When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the ",(0,i.kt)("a",{parentName:"p",href:"#output-syntax"},"output mode")," is set to something other than ",(0,i.kt)("inlineCode",{parentName:"p"},"interleaved")," (the default), or when interactive apps are run in parallel with other tasks."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"interactive: true")," tells Task this is an interactive application and Task will try to optimize for it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n default:\n cmds:\n - vim my-file.txt\n interactive: true\n")),(0,i.kt)("p",null,"If you still have problems running an interactive app through Task, please open an issue about it."),(0,i.kt)("h2",{id:"short-task-syntax"},"Short task syntax"),(0,i.kt)("p",null,"Starting on Task v3, you can now write tasks with a shorter syntax if they have the default settings (e.g. no custom ",(0,i.kt)("inlineCode",{parentName:"p"},"env:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"vars:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"desc:"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"silent:")," , etc):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\ntasks:\n build: go build -v -o ./app{{exeExt}} .\n\n run:\n - task: build\n - ./app{{exeExt}} -h localhost -p 8080\n")),(0,i.kt)("h2",{id:"set-and-shopt"},(0,i.kt)("inlineCode",{parentName:"h2"},"set")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"shopt")),(0,i.kt)("p",null,"It's possible to specify options to the ",(0,i.kt)("a",{parentName:"p",href:"https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html"},(0,i.kt)("inlineCode",{parentName:"a"},"set"))," and ",(0,i.kt)("a",{parentName:"p",href:"https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html"},(0,i.kt)("inlineCode",{parentName:"a"},"shopt"))," builtins. This can be added at global, task or command level."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"version: '3'\n\nset: [pipefail]\nshopt: [globstar]\n\ntasks:\n # `globstar` required for double star globs to work\n default: echo **/*.go\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Keep in mind that not all options are available in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/mvdan/sh"},"shell interpreter library")," that Task uses.")),(0,i.kt)("h2",{id:"watch-tasks"},"Watch tasks"),(0,i.kt)("p",null,"With the flags ",(0,i.kt)("inlineCode",{parentName:"p"},"--watch")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-w")," task will watch for file changes and run the task again. This requires the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," attribute to be given, so task knows which files to watch."),(0,i.kt)("p",null,"The default watch interval is 5 seconds, but it's possible to change it by either setting ",(0,i.kt)("inlineCode",{parentName:"p"},"interval: '500ms'")," in the root of the Taskfile passing it as an argument like ",(0,i.kt)("inlineCode",{parentName:"p"},"--interval=500ms"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/d23ae857.0e7597ef.js b/pt-BR/assets/js/d23ae857.b36c887e.js similarity index 53% rename from pt-BR/assets/js/d23ae857.0e7597ef.js rename to pt-BR/assets/js/d23ae857.b36c887e.js index 6b3ae8fe..357d4dc1 100644 --- a/pt-BR/assets/js/d23ae857.0e7597ef.js +++ b/pt-BR/assets/js/d23ae857.b36c887e.js @@ -1 +1 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[176],{3905:function(e,t,r){r.d(t,{Zo:function(){return l},kt:function(){return m}});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=s(r),f=o,m=p["".concat(c,".").concat(f)]||p[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[p]="string"==typeof e?e:o,i[1]=u;for(var s=2;s=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=c(r),f=o,m=l["".concat(s,".").concat(f)]||l[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u[l]="string"==typeof e?e:o,i[1]=u;for(var c=2;c=0||(s[t]=e[t]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=c(t),m=s,k=u["".concat(l,".").concat(m)]||u[m]||p[m]||r;return t?a.createElement(k,o(o({ref:n},d),{},{components:t})):a.createElement(k,o({ref:n},d))}));function k(e,n){var t=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=t.length,o=new Array(r);o[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[u]="string"==typeof e?e:s,o[1]=i;for(var c=2;cTaskfile.yml and not taskfile.yml",id:"use-taskfileyml-and-not-taskfileyml",level:2},{value:"Use the correct order of keywords",id:"use-the-correct-order-of-keywords",level:2},{value:"Use 2 spaces for indentation",id:"use-2-spaces-for-indentation",level:2},{value:"Separate with spaces the mains sections",id:"separate-with-spaces-the-mains-sections",level:2},{value:"Add spaces between tasks",id:"add-spaces-between-tasks",level:2},{value:"Use upper-case variable names",id:"use-upper-case-variable-names",level:2},{value:"Don't wrap vars in spaces when templating",id:"dont-wrap-vars-in-spaces-when-templating",level:2},{value:"Separate task name words with a dash",id:"separate-task-name-words-with-a-dash",level:2},{value:"Use colon for task namespacing",id:"use-colon-for-task-namespacing",level:2}],d={toc:c};function u(e){let{components:n,...t}=e;return(0,s.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,s.kt)("h1",{id:"guia-de-estilo"},"Guia de estilo"),(0,s.kt)("p",null,"This is the official Task styleguide for ",(0,s.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," files. This guide contains some basic instructions to keep your Taskfile clean and familiar to other users."),(0,s.kt)("p",null,"This contains general guidelines, but they don't necessarily need to be strictly followed. Feel free to disagree and proceed differently at some point if you need or want to. Also, feel free to open issues or pull requests with improvements to this guide."),(0,s.kt)("h2",{id:"use-taskfileyml-and-not-taskfileyml"},"Use ",(0,s.kt)("inlineCode",{parentName:"h2"},"Taskfile.yml")," and not ",(0,s.kt)("inlineCode",{parentName:"h2"},"taskfile.yml")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\ntaskfile.yml\n\n\n# good\nTaskfile.yml\n")),(0,s.kt)("p",null,"This is important especially for Linux users. Windows and macOS have case insensitive filesystems, so ",(0,s.kt)("inlineCode",{parentName:"p"},"taskfile.yml")," will end up working, even that not officially supported. On Linux, only ",(0,s.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," will work, though."),(0,s.kt)("h2",{id:"use-the-correct-order-of-keywords"},"Use the correct order of keywords"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"version:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"includes:")),(0,s.kt)("li",{parentName:"ul"},"Configuration ones, like ",(0,s.kt)("inlineCode",{parentName:"li"},"output:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"silent:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"method:")," and ",(0,s.kt)("inlineCode",{parentName:"li"},"run:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"vars:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"env:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"dotenv:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"tasks:"))),(0,s.kt)("h2",{id:"use-2-spaces-for-indentation"},"Use 2 spaces for indentation"),(0,s.kt)("p",null,"This is the most common convention for YAML files, and Task follows it."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\ntasks:\n foo:\n cmds:\n - echo 'foo'\n\n\n# good\ntasks:\n foo:\n cmds:\n - echo 'foo'\n")),(0,s.kt)("h2",{id:"separate-with-spaces-the-mains-sections"},"Separate with spaces the mains sections"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\nincludes:\n docker: ./docker/Taskfile.yml\noutput: prefixed\nvars:\n FOO: bar\nenv:\n BAR: baz\ntasks:\n # ...\n\n\n# good\nversion: '3'\n\nincludes:\n docker: ./docker/Taskfile.yml\n\noutput: prefixed\n\nvars:\n FOO: bar\n\nenv:\n BAR: baz\n\ntasks:\n # ...\n")),(0,s.kt)("h2",{id:"add-spaces-between-tasks"},"Add spaces between tasks"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n foo:\n cmds:\n - echo 'foo'\n bar:\n cmds:\n - echo 'bar'\n baz:\n cmds:\n - echo 'baz'\n\n\n# good\nversion: '3'\n\ntasks:\n foo:\n cmds:\n - echo 'foo'\n\n bar:\n cmds:\n - echo 'bar'\n\n baz:\n cmds:\n - echo 'baz'\n")),(0,s.kt)("h2",{id:"use-upper-case-variable-names"},"Use upper-case variable names"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\nvars:\n binary_name: myapp\n\ntasks:\n build:\n cmds:\n - go build -o {{.binary_name}} .\n\n\n# good\nversion: '3'\n\nvars:\n BINARY_NAME: myapp\n\ntasks:\n build:\n cmds:\n - go build -o {{.BINARY_NAME}} .\n")),(0,s.kt)("h2",{id:"dont-wrap-vars-in-spaces-when-templating"},"Don't wrap vars in spaces when templating"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n greet:\n cmds:\n - echo '{{ .MESSAGE }}'\n\n\n# good\nversion: '3'\n\ntasks:\n greet:\n cmds:\n - echo '{{.MESSAGE}}'\n")),(0,s.kt)("p",null,"This convention is also used by most people for any Go templating."),(0,s.kt)("h2",{id:"separate-task-name-words-with-a-dash"},"Separate task name words with a dash"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n do_something_fancy:\n cmds:\n - echo 'Do something'\n\n\n# good\nversion: '3'\n\ntasks:\n do-something-fancy:\n cmds:\n - echo 'Do something'\n")),(0,s.kt)("h2",{id:"use-colon-for-task-namespacing"},"Use colon for task namespacing"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# good\nversion: '3'\n\ntasks:\n docker:build:\n cmds:\n - docker ...\n\n docker:run:\n cmds:\n - docker-compose ...\n")),(0,s.kt)("p",null,"This is also done automatically when using included Taskfiles."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/e8ea0ffb.fcf3a6b5.js b/pt-BR/assets/js/e8ea0ffb.fcf3a6b5.js deleted file mode 100644 index 239d82c4..00000000 --- a/pt-BR/assets/js/e8ea0ffb.fcf3a6b5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[467],{3905:function(e,n,t){t.d(n,{Zo:function(){return d},kt:function(){return k}});var a=t(7294);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(s[t]=e[t]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(t),m=s,k=p["".concat(l,".").concat(m)]||p[m]||u[m]||r;return t?a.createElement(k,o(o({ref:n},d),{},{components:t})):a.createElement(k,o({ref:n},d))}));function k(e,n){var t=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=t.length,o=new Array(r);o[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,o[1]=i;for(var c=2;cTaskfile.yml and not taskfile.yml",id:"use-taskfileyml-and-not-taskfileyml",level:2},{value:"Use the correct order of keywords",id:"use-the-correct-order-of-keywords",level:2},{value:"Use 2 spaces for indentation",id:"use-2-spaces-for-indentation",level:2},{value:"Separate with spaces the mains sections",id:"separate-with-spaces-the-mains-sections",level:2},{value:"Add spaces between tasks",id:"add-spaces-between-tasks",level:2},{value:"Use upper-case variable names",id:"use-upper-case-variable-names",level:2},{value:"Don't wrap vars in spaces when templating",id:"dont-wrap-vars-in-spaces-when-templating",level:2},{value:"Separate task name words with a dash",id:"separate-task-name-words-with-a-dash",level:2},{value:"Use colon for task namespacing",id:"use-colon-for-task-namespacing",level:2}],d={toc:c};function p(e){let{components:n,...t}=e;return(0,s.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,s.kt)("h1",{id:"styleguide"},"Styleguide"),(0,s.kt)("p",null,"This is the official Task styleguide for ",(0,s.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," files. This guide contains some basic instructions to keep your Taskfile clean and familiar to other users."),(0,s.kt)("p",null,"This contains general guidelines, but they don't necessarily need to be strictly followed. Feel free to disagree and proceed differently at some point if you need or want to. Also, feel free to open issues or pull requests with improvements to this guide."),(0,s.kt)("h2",{id:"use-taskfileyml-and-not-taskfileyml"},"Use ",(0,s.kt)("inlineCode",{parentName:"h2"},"Taskfile.yml")," and not ",(0,s.kt)("inlineCode",{parentName:"h2"},"taskfile.yml")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\ntaskfile.yml\n\n\n# good\nTaskfile.yml\n")),(0,s.kt)("p",null,"This is important especially for Linux users. Windows and macOS have case insensitive filesystems, so ",(0,s.kt)("inlineCode",{parentName:"p"},"taskfile.yml")," will end up working, even that not officially supported. On Linux, only ",(0,s.kt)("inlineCode",{parentName:"p"},"Taskfile.yml")," will work, though."),(0,s.kt)("h2",{id:"use-the-correct-order-of-keywords"},"Use the correct order of keywords"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"version:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"includes:")),(0,s.kt)("li",{parentName:"ul"},"Configuration ones, like ",(0,s.kt)("inlineCode",{parentName:"li"},"output:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"silent:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"method:")," and ",(0,s.kt)("inlineCode",{parentName:"li"},"run:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"vars:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"env:"),", ",(0,s.kt)("inlineCode",{parentName:"li"},"dotenv:")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("inlineCode",{parentName:"li"},"tasks:"))),(0,s.kt)("h2",{id:"use-2-spaces-for-indentation"},"Use 2 spaces for indentation"),(0,s.kt)("p",null,"This is the most common convention for YAML files, and Task follows it."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\ntasks:\n foo:\n cmds:\n - echo 'foo'\n\n\n# good\ntasks:\n foo:\n cmds:\n - echo 'foo'\n")),(0,s.kt)("h2",{id:"separate-with-spaces-the-mains-sections"},"Separate with spaces the mains sections"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\nincludes:\n docker: ./docker/Taskfile.yml\noutput: prefixed\nvars:\n FOO: bar\nenv:\n BAR: baz\ntasks:\n # ...\n\n\n# good\nversion: '3'\n\nincludes:\n docker: ./docker/Taskfile.yml\n\noutput: prefixed\n\nvars:\n FOO: bar\n\nenv:\n BAR: baz\n\ntasks:\n # ...\n")),(0,s.kt)("h2",{id:"add-spaces-between-tasks"},"Add spaces between tasks"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n foo:\n cmds:\n - echo 'foo'\n bar:\n cmds:\n - echo 'bar'\n baz:\n cmds:\n - echo 'baz'\n\n\n# good\nversion: '3'\n\ntasks:\n foo:\n cmds:\n - echo 'foo'\n\n bar:\n cmds:\n - echo 'bar'\n\n baz:\n cmds:\n - echo 'baz'\n")),(0,s.kt)("h2",{id:"use-upper-case-variable-names"},"Use upper-case variable names"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\nvars:\n binary_name: myapp\n\ntasks:\n build:\n cmds:\n - go build -o {{.binary_name}} .\n\n\n# good\nversion: '3'\n\nvars:\n BINARY_NAME: myapp\n\ntasks:\n build:\n cmds:\n - go build -o {{.BINARY_NAME}} .\n")),(0,s.kt)("h2",{id:"dont-wrap-vars-in-spaces-when-templating"},"Don't wrap vars in spaces when templating"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n greet:\n cmds:\n - echo '{{ .MESSAGE }}'\n\n\n# good\nversion: '3'\n\ntasks:\n greet:\n cmds:\n - echo '{{.MESSAGE}}'\n")),(0,s.kt)("p",null,"This convention is also used by most people for any Go templating."),(0,s.kt)("h2",{id:"separate-task-name-words-with-a-dash"},"Separate task name words with a dash"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# bad\nversion: '3'\n\ntasks:\n do_something_fancy:\n cmds:\n - echo 'Do something'\n\n\n# good\nversion: '3'\n\ntasks:\n do-something-fancy:\n cmds:\n - echo 'Do something'\n")),(0,s.kt)("h2",{id:"use-colon-for-task-namespacing"},"Use colon for task namespacing"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-yaml"},"# good\nversion: '3'\n\ntasks:\n docker:build:\n cmds:\n - docker ...\n\n docker:run:\n cmds:\n - docker-compose ...\n")),(0,s.kt)("p",null,"This is also done automatically when using included Taskfiles."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/ee2b4fdf.11b95856.js b/pt-BR/assets/js/ee2b4fdf.11b95856.js deleted file mode 100644 index b7d83419..00000000 --- a/pt-BR/assets/js/ee2b4fdf.11b95856.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[955],{3905:function(t,e,n){n.d(e,{Zo:function(){return p},kt:function(){return f}});var r=n(7294);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var l=r.createContext({}),u=function(t){var e=r.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},p=function(t){var e=u(t.components);return r.createElement(l.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},h=r.forwardRef((function(t,e){var n=t.components,o=t.mdxType,a=t.originalType,l=t.parentName,p=s(t,["components","mdxType","originalType","parentName"]),c=u(n),h=o,f=c["".concat(l,".").concat(h)]||c[h]||m[h]||a;return n?r.createElement(f,i(i({ref:e},p),{},{components:n})):r.createElement(f,i({ref:e},p))}));function f(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var a=n.length,i=new Array(a);i[0]=h;var s={};for(var l in e)hasOwnProperty.call(e,l)&&(s[l]=e[l]);s.originalType=t,s[c]="string"==typeof t?t:o,i[1]=s;for(var u=2;u=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var l=r.createContext({}),u=function(t){var e=r.useContext(l),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},p=function(t){var e=u(t.components);return r.createElement(l.Provider,{value:e},t.children)},c="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},h=r.forwardRef((function(t,e){var n=t.components,o=t.mdxType,a=t.originalType,l=t.parentName,p=s(t,["components","mdxType","originalType","parentName"]),c=u(n),h=o,d=c["".concat(l,".").concat(h)]||c[h]||m[h]||a;return n?r.createElement(d,i(i({ref:e},p),{},{components:n})):r.createElement(d,i({ref:e},p))}));function d(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var a=n.length,i=new Array(a);i[0]=h;var s={};for(var l in e)hasOwnProperty.call(e,l)&&(s[l]=e[l]);s.originalType=t,s[c]="string"==typeof t?t:o,i[1]=s;for(var u=2;u=0||(n[t]=e[t]);return n}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var s=o.createContext({}),p=function(e){var a=o.useContext(s),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},u=function(e){var a=p(e.components);return o.createElement(s.Provider,{value:a},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return o.createElement(o.Fragment,{},a)}},m=o.forwardRef((function(e,a){var t=e.components,n=e.mdxType,r=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=n,k=d["".concat(s,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(k,i(i({ref:a},u),{},{components:t})):o.createElement(k,i({ref:a},u))}));function k(e,a){var t=arguments,n=a&&a.mdxType;if("string"==typeof e||n){var r=t.length,i=new Array(r);i[0]=m;var l={};for(var s in a)hasOwnProperty.call(a,s)&&(l[s]=a[s]);l.originalType=e,l[d]="string"==typeof e?e:n,i[1]=l;for(var p=2;pauto-complete de terminal",id:"configurar-auto-complete-de-terminal",level:2},{value:"Bash",id:"bash",level:3},{value:"ZSH",id:"zsh",level:3},{value:"Fish",id:"fish",level:3},{value:"PowerShell",id:"powershell",level:3}],u={toc:p};function d(e){let{components:a,...t}=e;return(0,n.kt)("wrapper",(0,o.Z)({},u,t,{components:a,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"instala\xe7\xe3o"},"Instala\xe7\xe3o"),(0,n.kt)("p",null,"H\xe1 muitas maneiras poss\xedveis de se instalar o Task. Confira os m\xe9todos dispon\xedveis abaixo."),(0,n.kt)("h2",{id:"gerenciador-de-pacotes"},"Gerenciador de Pacotes"),(0,n.kt)("h3",{id:"homebrew"},"Homebrew"),(0,n.kt)("p",null,"Se voc\xea estiver no macOS ou Linux e tiver o ",(0,n.kt)("a",{parentName:"p",href:"https://brew.sh/"},"Homebrew")," instalado, instalar o Task \xe9 t\xe3o simples quanto rodar:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"brew install go-task/tap/go-task\n")),(0,n.kt)("p",null,"A f\xf3rmula acima \xe9 ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb"},"mantida por n\xf3s mesmos"),"."),(0,n.kt)("p",null,"Recentemente, o Task tamb\xe9m foi disponibilizado ",(0,n.kt)("a",{parentName:"p",href:"https://formulae.brew.sh/formula/go-task"},"no reposit\xf3rio oficial do Homebrew"),", ent\xe3o voc\xea tamb\xe9m tem essa op\xe7\xe3o, se preferir:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"brew install go-task\n")),(0,n.kt)("h3",{id:"snap"},"Snap"),(0,n.kt)("p",null,"O Task est\xe1 dispon\xedvel no ",(0,n.kt)("a",{parentName:"p",href:"https://snapcraft.io/task"},"Snapcraft"),", mas tenha em mente que a sua distribui\xe7\xe3o Linux deve suportar confinamento cl\xe1ssico (",(0,n.kt)("em",{parentName:"p"},"classic confinement"),") para Snaps para o Task funcionar corretamente:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"sudo snap install task --classic\n")),(0,n.kt)("h3",{id:"chocolatey"},"Chocolatey"),(0,n.kt)("p",null,"Se voc\xea estiver no Windows e tiver o ",(0,n.kt)("a",{parentName:"p",href:"https://chocolatey.org/"},"Chocolatey")," instalado, instalar o Task \xe9 t\xe3o simples quanto rodar:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"choco install go-task\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade."),(0,n.kt)("h3",{id:"scoop"},"Scoop"),(0,n.kt)("p",null,"Se voc\xea est\xe1 no Windows e tem o ",(0,n.kt)("a",{parentName:"p",href:"https://scoop.sh/"},"Scoop")," instalado, instalar o Task \xe9 t\xe3o simples quanto rodar:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-cmd"},"scoop install task\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade. Ap\xf3s o lan\xe7amento de uma nova vers\xe3o do Task, pode levar algum tempo at\xe9 que esteja dispon\xedvel no Scoop."),(0,n.kt)("h3",{id:"aur"},"AUR"),(0,n.kt)("p",null,"Se voc\xea estiver no Arch Linux, voc\xea pode instalar o Task a partir do ",(0,n.kt)("a",{parentName:"p",href:"https://aur.archlinux.org/packages/go-task-bin"},"AUR")," usando o seu gerenciador de pacotes favorito, como ",(0,n.kt)("inlineCode",{parentName:"p"},"yay"),", ",(0,n.kt)("inlineCode",{parentName:"p"},"pacauro")," ou ",(0,n.kt)("inlineCode",{parentName:"p"},"yaourt"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task-bin\n")),(0,n.kt)("p",null,"Alternativamente, h\xe1 ",(0,n.kt)("a",{parentName:"p",href:"https://aur.archlinux.org/packages/go-task"},"este pacote")," que instala do c\xf3digo fonte ao inv\xe9s de baixar o bin\xe1rio ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"do GitHub"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-cmd"},"yay -S go-task\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade."),(0,n.kt)("h3",{id:"fedora"},"Fedora"),(0,n.kt)("p",null,"Se voc\xea estiver no Fedora Linux, voc\xea pode instalar o Task do ",(0,n.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"reposit\xf3rio oficial do Fedora")," usando ",(0,n.kt)("inlineCode",{parentName:"p"},"dnf"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-cmd"},"sudo dnf install go-task\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade. Ap\xf3s o lan\xe7amento de uma nova vers\xe3o do Task, pode levar algum tempo at\xe9 que ela esteja dispon\xedvel no ",(0,n.kt)("a",{parentName:"p",href:"https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/"},"Fedora"),"."),(0,n.kt)("h3",{id:"nix"},"Nix"),(0,n.kt)("p",null,"Se voc\xea estiver no NixOS ou tiver o Nix instalado, voc\xea pode instalar o Task a partir do ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-cmd"},"nix-env -iA nixpkgs.go-task\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade. Ap\xf3s o lan\xe7amento de uma nova vers\xe3o do Task, pode levar algum tempo at\xe9 que ela esteja dispon\xedvel em ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/NixOS/nixpkgs"},"nixpkgs"),"."),(0,n.kt)("h3",{id:"npm"},"npm"),(0,n.kt)("p",null,"Voc\xea tamb\xe9m pode usar o Node e o npm para instalar o Task instalando ",(0,n.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/@go-task/cli"},"este pacote"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g @go-task/cli\n")),(0,n.kt)("h3",{id:"winget"},"Winget"),(0,n.kt)("p",null,"Se voc\xea estiver usando o Windows e instalando a ferramenta de gerenciamento de pacotes ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/microsoft/winget-cli"},"winget"),", voc\xea pode instalar o Task a partir de ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/microsoft/winget-pkgs"},"winget-pkgs"),"."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"winget install Task.Task\n")),(0,n.kt)("h2",{id:"baixe-o-bin\xe1rio"},"Baixe o Bin\xe1rio"),(0,n.kt)("h3",{id:"bin\xe1rio"},"Bin\xe1rio"),(0,n.kt)("p",null,"Voc\xea pode baixar o bin\xe1rio da ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/releases"},"p\xe1gina de vers\xf5es no GitHub")," e adicionar a sua vari\xe1vel de ambiente ",(0,n.kt)("inlineCode",{parentName:"p"},"$PATH"),"."),(0,n.kt)("p",null,"Os pacotes DEB e RPM tamb\xe9m est\xe3o dispon\xedveis."),(0,n.kt)("p",null,"O arquivo ",(0,n.kt)("inlineCode",{parentName:"p"},"task_checksums.txt")," cont\xe9m a ",(0,n.kt)("em",{parentName:"p"},"checksum")," SHA-256 para cada arquivo."),(0,n.kt)("h3",{id:"script-de-instala\xe7\xe3o"},"Script de instala\xe7\xe3o"),(0,n.kt)("p",null,"Tamb\xe9m temos um ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/main/install-task.sh"},"script de instala\xe7\xe3o")," que \xe9 muito \xfatil em cen\xe1rios, como CI. Muito obrigado ao ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/goreleaser/godownloader"},"GoDownloader")," por permitir a gera\xe7\xe3o f\xe1cil deste script."),(0,n.kt)("p",null,"Por padr\xe3o, o bin\xe1rio ser\xe1 baixado no diret\xf3rio ",(0,n.kt)("inlineCode",{parentName:"p"},"./bin")," em rela\xe7\xe3o ao diret\xf3rio atual:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d\n')),(0,n.kt)("p",null,"\xc9 poss\xedvel substituir o diret\xf3rio de instala\xe7\xe3o com o par\xe2metro ",(0,n.kt)("inlineCode",{parentName:"p"},"-b"),". No Linux, escolhas comuns s\xe3o ",(0,n.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," e ",(0,n.kt)("inlineCode",{parentName:"p"},"~/bin")," para instalar para o usu\xe1rio ou ",(0,n.kt)("inlineCode",{parentName:"p"},"/usr/local/bin")," para instalar para todos os usu\xe1rios:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin\n')),(0,n.kt)("admonition",{type:"caution"},(0,n.kt)("p",{parentName:"admonition"},"No macOS e Windows, ",(0,n.kt)("inlineCode",{parentName:"p"},"~/.local/bin")," e ",(0,n.kt)("inlineCode",{parentName:"p"},"~/bin")," n\xe3o s\xe3o adicionados ao ",(0,n.kt)("inlineCode",{parentName:"p"},"$PATH")," por padr\xe3o.")),(0,n.kt)("h3",{id:"github-actions"},"GitHub Actions"),(0,n.kt)("p",null,"Se voc\xea quiser instalar o Task no GitHub Actions voc\xea pode tentar usar ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/arduino/setup-task"},"esta ",(0,n.kt)("em",{parentName:"a"},"action"))," pela equipe do Arduino:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-yaml"},"- name: Install Task\n uses: arduino/setup-task@v1\n with:\n version: 3.x\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n")),(0,n.kt)("p",null,"Este m\xe9todo de instala\xe7\xe3o \xe9 mantido pela comunidade."),(0,n.kt)("h2",{id:"compilar-do-c\xf3digo-fonte"},"Compilar do c\xf3digo-fonte"),(0,n.kt)("h3",{id:"go-modules"},"Go Modules"),(0,n.kt)("p",null,"Certifique-se de que voc\xea tem uma vers\xe3o suportada do ",(0,n.kt)("a",{parentName:"p",href:"https://golang.org/"},"Go")," corretamente instalado e configurado. Voc\xea pode encontrar a vers\xe3o m\xednima necess\xe1ria do Go no arquivo ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/blob/main/go.mod#L3"},"go.mod"),"."),(0,n.kt)("p",null,"Voc\xea pode ent\xe3o instalar a \xfaltima vers\xe3o globalmente ao rodar:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,n.kt)("p",null,"Ou voc\xea pode instalar em outro diret\xf3rio rodando:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-bash"},"env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest\n")),(0,n.kt)("admonition",{type:"tip"},(0,n.kt)("p",{parentName:"admonition"},"Para ambientes com CI, recomendamos usar o ",(0,n.kt)("a",{parentName:"p",href:"#install-script"},"script de instala\xe7\xe3o"),", que \xe9 mais r\xe1pido e mais est\xe1vel, j\xe1 que ele apenas baixar\xe1 o \xfaltimo bin\xe1rio lan\xe7ado.")),(0,n.kt)("h2",{id:"configurar-auto-complete-de-terminal"},"Configurar ",(0,n.kt)("em",{parentName:"h2"},"auto-complete")," de terminal"),(0,n.kt)("p",null,"Baixe o arquivo de ",(0,n.kt)("em",{parentName:"p"},"auto-completion")," correspondente ao seu terminal."),(0,n.kt)("p",null,(0,n.kt)("a",{parentName:"p",href:"https://github.com/go-task/task/tree/main/completion"},"Todos os scripts de ",(0,n.kt)("em",{parentName:"a"},"completion")," est\xe3o dispon\xedveis no reposit\xf3rio do Task"),"."),(0,n.kt)("h3",{id:"bash"},"Bash"),(0,n.kt)("p",null,"Primeiro, certifique-se de que voc\xea instalou o ",(0,n.kt)("em",{parentName:"p"},"bash-completion")," usando seu gerenciador de pacotes."),(0,n.kt)("p",null,"Torne o arquivo de ",(0,n.kt)("em",{parentName:"p"},"completion")," execut\xe1vel:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre"},"chmod +x path/to/task.bash\n")),(0,n.kt)("p",null,"Depois, adicione isto ao seu ",(0,n.kt)("inlineCode",{parentName:"p"},"~/.bash_profile"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-shell"},"source path/to/task.bash\n")),(0,n.kt)("h3",{id:"zsh"},"ZSH"),(0,n.kt)("p",null,"Coloque o arquivo ",(0,n.kt)("inlineCode",{parentName:"p"},"_task")," em algum lugar no seu ",(0,n.kt)("inlineCode",{parentName:"p"},"$FPATH"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/_task /usr/local/share/zsh/site-functions/_task\n")),(0,n.kt)("p",null,"Certifique-se de que o seguinte esteja presente em seu ",(0,n.kt)("inlineCode",{parentName:"p"},"~/.zshrc"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-shell"},"autoload -U compinit\ncompinit -i\n")),(0,n.kt)("p",null,"Recomenda-se ZSH vers\xe3o 5.7 ou posterior."),(0,n.kt)("h3",{id:"fish"},"Fish"),(0,n.kt)("p",null,"Mova o script de ",(0,n.kt)("em",{parentName:"p"},"completion")," ",(0,n.kt)("inlineCode",{parentName:"p"},"task.fish"),":"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-shell"},"mv path/to/task.fish ~/.config/fish/completions/task.fish\n")),(0,n.kt)("h3",{id:"powershell"},"PowerShell"),(0,n.kt)("p",null,"Abra seu ",(0,n.kt)("em",{parentName:"p"},"profile script")," rodando:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre"},"mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue\nnotepad $profile\n")),(0,n.kt)("p",null,"Adicione a seguinte linha e salve o arquivo:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-shell"},"Invoke-Expression -Command path/to/task.ps1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/pt-BR/assets/js/f2ae99f3.f2bfc858.js b/pt-BR/assets/js/f2ae99f3.f2bfc858.js deleted file mode 100644 index 565808d1..00000000 --- a/pt-BR/assets/js/f2ae99f3.f2bfc858.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunktaskfile_dev=self.webpackChunktaskfile_dev||[]).push([[211],{3905:function(e,t,a){a.d(t,{Zo:function(){return u},kt:function(){return h}});var n=a(7294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),c=p(a),m=l,h=c["".concat(s,".").concat(m)]||c[m]||k[m]||o;return a?n.createElement(h,i(i({ref:t},u),{},{components:a})):n.createElement(h,i({ref:t},u))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,i=new Array(o);i[0]=m;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:l,i[1]=r;for(var p=2;p=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=o.createContext({}),p=function(e){var t=o.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return r?o.createElement(f,i(i({ref:t},c),{},{components:r})):o.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:n,i[1]=s;for(var p=2;p=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var p=2;p=o)&&Object.keys(u.O).every((function(e){return u.O[e](n[i])}))?n.splice(i--,1):(a=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},u.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var f={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((function(t){f[t]=function(){return e[t]}}));return f.default=function(){return e},u.d(o,f),o},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.f={},u.e=function(e){return Promise.all(Object.keys(u.f).reduce((function(t,n){return u.f[n](e,t),t}),[]))},u.u=function(e){return"assets/js/"+({19:"19a1e173",53:"935f2afb",133:"f1d66b0d",154:"4a59651f",176:"d23ae857",211:"f2ae99f3",259:"fcec3894",364:"ad872c75",385:"8420b8df",418:"19b14462",430:"6905f42e",445:"4a484b02",467:"e8ea0ffb",514:"1be78505",595:"d0766b26",629:"b9256968",791:"31fd616d",918:"17896441",920:"1a4e3797",955:"ee2b4fdf"}[e]||e)+"."+{19:"fa0df646",53:"3a9c3e69",133:"6862b446",154:"97fe7e06",176:"0e7597ef",211:"f2bfc858",259:"f0e483ef",364:"7e629dc5",385:"3538c872",418:"ffc50926",430:"284fd962",445:"0b0dd730",467:"fcf3a6b5",514:"9062895a",595:"c5627647",629:"a17fa1ee",780:"b979b06f",791:"d6792d13",894:"4bf7d380",918:"e75765f6",920:"a9132d06",945:"3694633c",955:"11b95856",972:"01a5a892"}[e]+".js"},u.miniCssF=function(e){},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="taskfile-dev:",u.l=function(e,t,n,f){if(r[e])r[e].push(t);else{var a,i;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d=o)&&Object.keys(i.O).every((function(e){return i.O[e](n[a])}))?n.splice(a--,1):(u=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},i.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);i.r(o);var f={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach((function(t){f[t]=function(){return e[t]}}));return f.default=function(){return e},i.d(o,f),o},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(t,n){return i.f[n](e,t),t}),[]))},i.u=function(e){return"assets/js/"+({19:"19a1e173",53:"935f2afb",133:"f1d66b0d",154:"4a59651f",176:"d23ae857",211:"f2ae99f3",259:"fcec3894",364:"ad872c75",385:"8420b8df",418:"19b14462",430:"6905f42e",445:"4a484b02",467:"e8ea0ffb",514:"1be78505",595:"d0766b26",629:"b9256968",791:"31fd616d",918:"17896441",920:"1a4e3797",955:"ee2b4fdf"}[e]||e)+"."+{19:"f78a02ec",53:"c53862c1",133:"6862b446",154:"97fe7e06",176:"b36c887e",211:"f0a7970f",259:"0cbe4614",364:"5776bf79",385:"dd8684c7",418:"1ef0ded7",430:"e4f764bf",445:"5e12d515",467:"f8d1075f",514:"9062895a",595:"c5627647",629:"5f33e496",780:"b979b06f",791:"cfc7c78e",894:"4bf7d380",918:"e75765f6",920:"a9132d06",945:"3694633c",955:"827f92cd",972:"01a5a892"}[e]+".js"},i.miniCssF=function(e){},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="taskfile-dev:",i.l=function(e,t,n,f){if(r[e])r[e].push(t);else{var u,a;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d