mirror of
https://github.com/go-task/task.git
synced 2026-06-26 14:16:16 +00:00
Website: Sync translations (#1103)
This commit is contained in:
@@ -17,12 +17,10 @@ task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If `--` is given, all remaning arguments will be assigned to a special `CLI_ARGS` variable
|
||||
|
||||
:::
|
||||
|
||||
|
||||
| Short | Flag | Type | Default | Description |
|
||||
| ----- | --------------------------- | -------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | Colored output. Enabled by default. Set flag to `false` or use `NO_COLOR=1` to disable. |
|
||||
@@ -137,7 +135,6 @@ Some environment variables can be overriden to adjust Task behavior.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Informing only a string like below is equivalent to setting that value to the `taskfile` attribute.
|
||||
|
||||
```yaml
|
||||
@@ -147,7 +144,6 @@ includes:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Variable
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@@ -157,7 +153,6 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Static and dynamic variables have different syntaxes, like below:
|
||||
|
||||
```yaml
|
||||
@@ -169,7 +164,6 @@ vars:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Task
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@@ -201,7 +195,6 @@ vars:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
These alternative syntaxes are available. They will set the given values to `cmds` and everything else will be set to their default values:
|
||||
|
||||
```yaml
|
||||
@@ -218,7 +211,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Command
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@@ -235,7 +227,6 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
If given as a a string, the value will be assigned to `cmd`:
|
||||
|
||||
```yaml
|
||||
@@ -248,7 +239,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Dependency
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@@ -258,7 +248,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If you don't want to set additional variables, it's enough to declare the dependency as a list of strings (they will be assigned to `task`):
|
||||
|
||||
```yaml
|
||||
@@ -269,7 +258,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
#### Precondition
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
@@ -279,7 +267,6 @@ tasks:
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
If you don't want to set a different message, you can declare a precondition like this and the value will be assigned to `sh`:
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -14,9 +14,9 @@ Contributions to Task are very welcome, but we ask that you read this document b
|
||||
|
||||
## 1. Setup
|
||||
|
||||
- **Go** - Task is written in [Go](https://go.dev). We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js](https://nodejs.org/en/) is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn](https://yarnpkg.com/) is the Node.js package manager used by Task.
|
||||
- **Go** - Task is written in [Go][]. We always support the latest two major Go versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js][] is used to host Task's documentation server and is required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn][] is the Node.js package manager used by Task.
|
||||
|
||||
## 2. Making changes
|
||||
|
||||
@@ -31,11 +31,11 @@ run ./cmd/task --dir ./testdata/<my_test_dir> <task_name>`.
|
||||
|
||||
### Updating documentation
|
||||
|
||||
Task uses [Docusaurus](https://docusaurus.io) to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
Task uses [Docusaurus][] to host a documentation server. This can be setup and run locally by using `task docs` (requires `nodejs` & `yarn`). All content is written in Markdown and is located in the `docs/docs` directory. All Markdown documents should have an 80 character line wrap limit.
|
||||
|
||||
When making a change, consider whether a change to the [Usage Guide](./usage.md) is necessary. This document contains descriptions and examples of how to use Task features. If you're adding a new feature, try to find an appropriate place to add a new section. If you're updating an existing feature, ensure that the documentation and any examples are up-to-date. Ensure that any examples follow the [Taskfile Styleguide](./styleguide.md).
|
||||
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema](https://github.com/go-task/task/blob/master/docs/static/schema.json). The descriptions for fields in the API reference and the schema should match.
|
||||
If you added a new field, command or flag, ensure that you add it to the [API Reference](./api_reference.md). New fields also need to be added to the [JSON Schema][]. The descriptions for fields in the API reference and the schema should match.
|
||||
|
||||
### Writing tests
|
||||
|
||||
@@ -58,12 +58,22 @@ Try to write meaningful commit messages and avoid having too many commits on the
|
||||
|
||||
> I want to contribute, where do I start?
|
||||
|
||||
Take a look at the list of [open issues](https://github.com/go-task/task/issues). We have a [good first issue](https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label for simpler issues that are ideal for first time contributions.
|
||||
Take a look at the list of [open issues][]. We have a [good first issue][] label for simpler issues that are ideal for first time contributions.
|
||||
|
||||
All kinds of contributions are welcome, whether its a typo fix or a shiny new feature. You can also contribute by upvoting/commenting on issues, helping to answer questions or contributing to other [community projects](./community.md).
|
||||
|
||||
> I'm stuck, where can I get help?
|
||||
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server](https://discord.gg/6TY36E39UK) or open a [Discussion](https://github.com/go-task/task/discussions) on GitHub.
|
||||
If you have questions, feel free to ask them in the `#help` forum channel on our [Discord server][] or open a [Discussion][] on GitHub.
|
||||
|
||||
---
|
||||
|
||||
[Go]: https://go.dev
|
||||
[Node.js]: https://nodejs.org/en/
|
||||
[Yarn]: https://yarnpkg.com/
|
||||
[Docusaurus]: https://docusaurus.io
|
||||
[JSON Schema]: https://github.com/go-task/task/blob/master/docs/static/schema.json
|
||||
[open issues]: https://github.com/go-task/task/issues
|
||||
[good first issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
[Discord server]: https://discord.gg/6TY36E39UK
|
||||
[Discussion]: https://github.com/go-task/task/discussions
|
||||
|
||||
@@ -9,7 +9,7 @@ If you find this project useful, you can consider donating by using one of the c
|
||||
|
||||
This is just a way of saying "thank you", it won't give you any benefits like higher priority on issues or something similar.
|
||||
|
||||
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in the website homepage and on the GitHub repository README. Make contact with [@andreynering](https://github.com/andreynering) with the logo you want to be shown. Suspect businesses (gambling, casinos, etc) won't be allowed, though.
|
||||
Companies who donate at least $50/month will be featured as a "Gold Sponsor" in the website homepage and on the GitHub repository README. Make contact with [@andreynering][] with the logo you want to be shown. Suspect businesses (gambling, casinos, etc) won't be allowed, though.
|
||||
|
||||
## GitHub Sponsors
|
||||
|
||||
@@ -30,10 +30,12 @@ If you prefer [Open Collective](https://opencollective.com/task) you can donate
|
||||
|
||||
## PayPal
|
||||
|
||||
You can donate to [@andreynering](https://github.com/andreynering) via PayPal as well:
|
||||
You can donate to [@andreynering][] via PayPal as well:
|
||||
|
||||
- [Any value - One-time donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url)
|
||||
|
||||
## PIX (Brazil only)
|
||||
|
||||
And if you're Brazilian, you can also donate to [@andreynering](https://github.com/andreynering) via PIX by [using this QR Code](/img/pix.png).
|
||||
And if you're Brazilian, you can also donate to [@andreynering][] via PIX by [using this QR Code](/img/pix.png).
|
||||
|
||||
[@andreynering]: https://github.com/andreynering
|
||||
|
||||
@@ -31,10 +31,13 @@ The default shell on Windows (`cmd` and `powershell`) do not have commands like
|
||||
|
||||
- Use the `{{OS}}` function to run an OS-specific script.
|
||||
- Use something like `{{if eq OS "windows"}}powershell {{end}}<my_cmd>` to detect windows and run the command in Powershell directly.
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash](https://gitforwindows.org/) or [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
- Use a shell on Windows that supports these commands as builtins, such as [Git Bash][] or [WSL][].
|
||||
|
||||
We want to make improvements to this part of Task and the issues below track this work. Constructive comments and contributions are very welcome!
|
||||
|
||||
- [#197](https://github.com/go-task/task/issues/197)
|
||||
- [mvdan/sh#93](https://github.com/mvdan/sh/issues/93)
|
||||
- [mvdan/sh#97](https://github.com/mvdan/sh/issues/97)
|
||||
|
||||
[Git Bash]: https://gitforwindows.org/
|
||||
[WSL]: https://learn.microsoft.com/en-us/windows/wsl/install
|
||||
|
||||
@@ -11,7 +11,7 @@ Task offers many installation methods. Check out the available methods below.
|
||||
|
||||
### Homebrew
|
||||
|
||||
If you're on macOS or Linux and have [Homebrew](https://brew.sh/) installed, getting Task is as simple as running:
|
||||
If you're on macOS or Linux and have [Homebrew][homebrew] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
brew install go-task/tap/go-task
|
||||
@@ -27,7 +27,7 @@ brew install go-task
|
||||
|
||||
### Snap
|
||||
|
||||
Task is available in [Snapcraft](https://snapcraft.io/task), but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
Task is available in [Snapcraft][snapcraft], but keep in mind that your Linux distribution should allow classic confinement for Snaps to Task work right:
|
||||
|
||||
```bash
|
||||
sudo snap install task --classic
|
||||
@@ -35,7 +35,7 @@ sudo snap install task --classic
|
||||
|
||||
### Chocolatey
|
||||
|
||||
If you're on Windows and have [Chocolatey](https://chocolatey.org/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Chocolatey][choco] installed, getting Task is as simple as running:
|
||||
|
||||
```bash
|
||||
choco install go-task
|
||||
@@ -45,7 +45,7 @@ This installation method is community owned.
|
||||
|
||||
### Scoop
|
||||
|
||||
If you're on Windows and have [Scoop](https://scoop.sh/) installed, getting Task is as simple as running:
|
||||
If you're on Windows and have [Scoop][scoop] installed, getting Task is as simple as running:
|
||||
|
||||
```cmd
|
||||
scoop install task
|
||||
@@ -97,11 +97,19 @@ You can also use Node and npm to install Task by installing [this package](https
|
||||
npm install -g @go-task/cli
|
||||
```
|
||||
|
||||
### Winget
|
||||
|
||||
If you are using Windows and installed the [winget](https://github.com/microsoft/winget-cli) package management tool, you can install Task from [winget-pkgs](https://github.com/microsoft/winget-pkgs).
|
||||
|
||||
```bash
|
||||
winget install Task.Task
|
||||
```
|
||||
|
||||
## Get The Binary
|
||||
|
||||
### Binary
|
||||
|
||||
You can download the binary from the [releases page on GitHub](https://github.com/go-task/task/releases) and add to your `$PATH`.
|
||||
You can download the binary from the [releases page on GitHub][releases] and add to your `$PATH`.
|
||||
|
||||
DEB and RPM packages are also available.
|
||||
|
||||
@@ -109,7 +117,7 @@ The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
||||
|
||||
### Install Script
|
||||
|
||||
We also have an [install script](https://github.com/go-task/task/blob/master/install-task.sh) which is very useful in scenarios like CI. Many thanks to [GoDownloader](https://github.com/goreleaser/godownloader) for enabling the easy generation of this script.
|
||||
We also have an [install script][installscript] which is very useful in scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the easy generation of this script.
|
||||
|
||||
By default, it installs on the `./bin` directory relative to the working directory:
|
||||
|
||||
@@ -125,12 +133,10 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
|
||||
:::caution
|
||||
|
||||
|
||||
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by default.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
If you want to install Task in GitHub Actions you can try using [this action](https://github.com/arduino/setup-task) by the Arduino team:
|
||||
@@ -138,6 +144,9 @@ If you want to install Task in GitHub Actions you can try using [this action](ht
|
||||
```yaml
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 3.x
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
This installation method is community owned.
|
||||
@@ -146,7 +155,7 @@ This installation method is community owned.
|
||||
|
||||
### Go Modules
|
||||
|
||||
Ensure that you have a supported version of [Go](https://golang.org/) properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/master/go.mod#L3) file.
|
||||
Ensure that you have a supported version of [Go][go] properly installed and setup. You can find the minimum required version of Go in the [go.mod](https://github.com/go-task/task/blob/master/go.mod#L3) file.
|
||||
|
||||
You can then install the latest release globally by running:
|
||||
|
||||
@@ -162,12 +171,10 @@ env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
For CI environments we recommend using the [install script](#get-the-binary) instead, which is faster and more stable, since it'll just download the latest released binary.
|
||||
For CI environments we recommend using the [install script](#install-script) instead, which is faster and more stable, since it'll just download the latest released binary.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Setup completions
|
||||
|
||||
Download the autocompletion file corresponding to your shell.
|
||||
@@ -229,3 +236,12 @@ Add the line and save the file:
|
||||
```shell
|
||||
Invoke-Expression -Command path/to/task.ps1
|
||||
```
|
||||
|
||||
[go]: https://golang.org/
|
||||
[snapcraft]: https://snapcraft.io/task
|
||||
[homebrew]: https://brew.sh/
|
||||
[installscript]: https://github.com/go-task/task/blob/master/install-task.sh
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[godownloader]: https://github.com/goreleaser/godownloader
|
||||
[choco]: https://chocolatey.org/
|
||||
[scoop]: https://scoop.sh/
|
||||
|
||||
@@ -10,11 +10,11 @@ title: Home
|
||||
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
|
||||
</div>
|
||||
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, [GNU Make](https://www.gnu.org/software/make/).
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, [GNU Make][make].
|
||||
|
||||
Since it's written in [Go](https://go.dev/), Task is just a single binary and has no other dependencies, which means you don't need to mess with any complicated install setups just to use a build tool.
|
||||
Since it's written in [Go][go], Task is just a single binary and has no other dependencies, which means you don't need to mess with any complicated install setups just to use a build tool.
|
||||
|
||||
Once [installed](installation.md), you just need to describe your build tasks using a simple [YAML](http://yaml.org/) schema in a file called `Taskfile.yml`:
|
||||
Once [installed](installation.md), you just need to describe your build tasks using a simple [YAML][yaml] schema in a file called `Taskfile.yml`:
|
||||
|
||||
```yaml title="Taskfile.yml"
|
||||
version: '3'
|
||||
@@ -32,9 +32,9 @@ The above example is just the start, you can take a look at the [usage](/usage)
|
||||
|
||||
## Features
|
||||
|
||||
- [Easy installation](installation.md): just download a single binary, add to `$PATH` and you're done! Or you can also install using [Homebrew](https://brew.sh/), [Snapcraft](https://snapcraft.io/), or [Scoop](https://scoop.sh/) if you want.
|
||||
- [Easy installation](installation.md): just download a single binary, add to `$PATH` and you're done! Or you can also install using [Homebrew][homebrew], [Snapcraft][snapcraft], or [Scoop][scoop] if you want.
|
||||
- Available on CIs: by adding [this simple command](installation.md#install-script) to install on your CI script and you're ready to use Task as part of your CI pipeline;
|
||||
- Truly cross-platform: while most build tools only work well on Linux or macOS, Task also supports Windows thanks to [this shell interpreter for Go](https://github.com/mvdan/sh).
|
||||
- Truly cross-platform: while most build tools only work well on Linux or macOS, Task also supports Windows thanks to [this shell interpreter for Go][sh].
|
||||
- Great for code generation: you can easily [prevent a task from running](/usage#prevent-unnecessary-work) if a given set of files haven't changed since last run (based either on its timestamp or content).
|
||||
|
||||
## Gold Sponsors
|
||||
@@ -46,3 +46,10 @@ The above example is just the start, you can take a look at the [usage](/usage)
|
||||
| [](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
|
||||
|
||||
</div>
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[go]: https://go.dev/
|
||||
[yaml]: http://yaml.org/
|
||||
[homebrew]: https://brew.sh/
|
||||
[snapcraft]: https://snapcraft.io/
|
||||
[scoop]: https://scoop.sh/
|
||||
[sh]: https://github.com/mvdan/sh
|
||||
|
||||
@@ -5,7 +5,7 @@ sidebar_position: 10
|
||||
|
||||
# Releasing
|
||||
|
||||
The release process of Task is done with the help of [GoReleaser](https://goreleaser.com/). You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
The release process of Task is done with the help of [GoReleaser][goreleaser]. You can test the release process locally by calling the `test-release` task of the Taskfile.
|
||||
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release artifacts automatically when a new Git tag is pushed to master (raw executables and DEB and RPM packages).
|
||||
|
||||
@@ -13,18 +13,18 @@ Since v3.15.0, raw executables can also be reproduced and verified locally by ch
|
||||
|
||||
# Homebrew
|
||||
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb](https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb) file in the [Homebrew tap](https://github.com/go-task/homebrew-tap) repository to release the new version.
|
||||
Goreleaser will automatically push a new commit to the [Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap] repository to release the new version.
|
||||
|
||||
# npm
|
||||
|
||||
To release to npm update the version in the [`package.json`](https://github.com/go-task/task/blob/master/package.json#L3) file and then run `task npm:publish` to push it.
|
||||
To release to npm update the version in the [`package.json`][packagejson] file and then run `task npm:publish` to push it.
|
||||
|
||||
# Snapcraft
|
||||
|
||||
The [snap package](https://github.com/go-task/snap) requires to manual steps to release a new version:
|
||||
The [snap package][snappackage] requires to manual steps to release a new version:
|
||||
|
||||
* Updating the current version on [snapcraft.yaml](https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2).
|
||||
* Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard](https://snapcraft.io/task/releases).
|
||||
* Updating the current version on [snapcraft.yaml][snapcraftyaml].
|
||||
* Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on the [Snapcraft dashboard][snapcraftdashboard].
|
||||
|
||||
# Scoop
|
||||
|
||||
@@ -33,3 +33,11 @@ Scoop is a command-line package manager for the Windows operating system. Scoop
|
||||
# Nix
|
||||
|
||||
Nix is a community owned installation method. Nix package maintainers usually take care of updating versions there by editing [this file](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/go-task/default.nix). If you think its Task version is outdated, open an issue to let us know.
|
||||
|
||||
[goreleaser]: https://goreleaser.com/
|
||||
[homebrewtap]: https://github.com/go-task/homebrew-tap
|
||||
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
||||
[packagejson]: https://github.com/go-task/task/blob/master/package.json#L3
|
||||
[snappackage]: https://github.com/go-task/snap
|
||||
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
||||
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||
|
||||
@@ -89,7 +89,7 @@ tasks:
|
||||
|
||||
## Version 2.1
|
||||
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation](usage.md#output-syntax) for more info):
|
||||
Version 2.1 includes a global `output` option, to allow having more control over how commands output are printed to the console (see [documentation][output] for more info):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@@ -103,7 +103,7 @@ tasks:
|
||||
prefix: server
|
||||
```
|
||||
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here](usage.md#ignore-errors)):
|
||||
From this version it's also possible to ignore errors of a command or task (check documentation [here][ignore_errors]):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
@@ -149,7 +149,7 @@ tasks:
|
||||
- aws s3 cp .env s3://myenvironment
|
||||
```
|
||||
|
||||
Please check the [documentation](usage.md#including-other-taskfiles)
|
||||
Please check the [documentation][includes]
|
||||
|
||||
## Version 3
|
||||
|
||||
@@ -202,3 +202,7 @@ tasks:
|
||||
- Global + CLI variables
|
||||
- Call variables
|
||||
- Task variables
|
||||
|
||||
[output]: usage.md#output-syntax
|
||||
[ignore_errors]: usage.md#ignore-errors
|
||||
[includes]: usage.md#including-other-taskfiles
|
||||
|
||||
@@ -7,6 +7,9 @@ sidebar_position: 13
|
||||
|
||||
Want to help us translate this documentation? In this document we explain how.
|
||||
|
||||
Do NOT edit translated markdown files directly on the GitHub repository! We use [Crowdin](https://crowdin.com/project/taskfile) to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
Do NOT edit translated markdown files directly on the GitHub repository! We use [Crowdin][crowdin] to allow contributors on work on translations. The repository is periodically updated with progress from Crowdin.
|
||||
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server](https://discord.gg/6TY36E39UK). If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
If you want to have access to the Crowdin project to be able to suggest translations, please ask for access on the [#translations channel on our Discord server][discord]. If a given language is not being shown to Crowdin yet, just ask and we can configure it.
|
||||
|
||||
[crowdin]: https://crowdin.com/project/taskfile
|
||||
[discord]: https://discord.gg/6TY36E39UK
|
||||
|
||||
@@ -71,7 +71,6 @@ This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
When running your global Taskfile with `-g`, tasks will run on `$HOME` by default, and not on your working directory!
|
||||
|
||||
As mentioned in the previous section, the `{{.USER_WORKING_DIR}}` special variable can be very handy here to run stuff on the directory you're calling `task -g` from.
|
||||
@@ -92,7 +91,6 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Environment variables
|
||||
|
||||
### Task
|
||||
@@ -126,12 +124,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
`env` supports expansion and retrieving output from a shell command just like variables, as you can see in the [Variables](#variables) section.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### .env files
|
||||
|
||||
You can also ask Task to include `.env` like files by using the `dotenv:` setting:
|
||||
@@ -192,12 +188,10 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Please note that you are not currently able to use the `dotenv` key inside included Taskfiles.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Including other Taskfiles
|
||||
|
||||
If you want to share tasks between different projects (Taskfiles), you can use the importing mechanism to include other Taskfiles using the `includes` keyword:
|
||||
@@ -240,12 +234,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
The included Taskfiles must be using the same schema version as the main Taskfile uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Optional includes
|
||||
|
||||
Includes marked as optional will allow Task to continue execution as normal if the included file is missing.
|
||||
@@ -311,12 +303,10 @@ includes:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Vars declared in the included Taskfile have preference over the variables in the including Taskfile! If you want a variable in an included Taskfile to be overridable, use the [default function](https://go-task.github.io/slim-sprig/defaults.html): `MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Internal tasks
|
||||
|
||||
Internal tasks are tasks that cannot be called directly by the user. They will not appear in the output when running `task --list|--list-all`. Other tasks may call internal tasks in the usual way. This is useful for creating reusable, function-like tasks that have no useful purpose on the command line.
|
||||
@@ -398,12 +388,10 @@ If there is more than one dependency, they always run in parallel for better per
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
You can also make the tasks given by the command line run in parallel by using the `--parallel` flag (alias `-p`). Example: `task --parallel js css`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
If you want to pass information to dependencies, you can do that the same manner as you would to [call another task](#calling-another-task):
|
||||
|
||||
```yaml
|
||||
@@ -536,12 +524,10 @@ The above syntax is also supported in `deps`.
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
NOTE: If you want to call a task declared in the root Taskfile from within an [included Taskfile](#including-other-taskfiles), add a leading `:` like this: `task: :task-name`.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Prevent unnecessary work
|
||||
|
||||
### By fingerprinting locally generated files and their sources
|
||||
@@ -596,7 +582,6 @@ In situations where you need more flexibility the `status` keyword can be used.
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
By default, task stores checksums on a local `.task` directory in the project's directory. Most of the time, you'll want to have this directory on `.gitignore` (or equivalent) so it isn't committed. (If you have a task for code generation that is committed it may make sense to commit the checksum of that task as well, though).
|
||||
|
||||
If you want these files to be stored in another directory, you can set a `TASK_TEMP_DIR` environment variable in your machine. It can contain a relative path like `tmp/task` that will be interpreted as relative to the project directory, or an absolute or home path like `/tmp/.task` or `~/.task` (subdirectories will be created for each project).
|
||||
@@ -607,33 +592,26 @@ export TASK_TEMP_DIR='~/.task'
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Each task has only one checksum stored for its `sources`. If you want to distinguish a task by any of its input variables, you can add those variables as part of the task's label, and it will be considered a different task.
|
||||
|
||||
This is useful if you want to run a task once for each distinct set of inputs until the sources actually change. For example, if the sources depend on the value of a variable, or you if you want the task to rerun if some arguments change even if the source has not.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The method `none` skips any validation and always run the task.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
For the `checksum` (default) or `timestamp` method to work, it is only necessary to inform the source files. When the `timestamp` method is used, the last time of the running the task is considered as a generate.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Using programmatic checks to indicate a task is up to date.
|
||||
|
||||
Alternatively, you can inform a sequence of tests as `status`. If no error is returned (exit status 0), the task is considered up-to-date:
|
||||
@@ -787,12 +765,10 @@ $ TASK_VARIABLE=a-value task do-something
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
A special variable `.TASK` is always available containing the task name.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
Since some shells do not support the above syntax to set environment variables (Windows) tasks also accept a similar style when not at the beginning of the command.
|
||||
|
||||
```bash
|
||||
@@ -897,15 +873,13 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Due to the nature of how the [Go's own `defer` work](https://go.dev/tour/flowcontrol/13), the deferred commands are executed in the reverse order if you schedule multiple of them.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Go's template engine
|
||||
|
||||
Task parse commands as [Go's template engine](https://golang.org/pkg/text/template/) before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
Task parse commands as [Go's template engine][gotemplate] before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
|
||||
All functions by the Go's [slim-sprig lib](https://go-task.github.io/slim-sprig/) are available. The following example gets the current date in a given format:
|
||||
|
||||
@@ -1289,12 +1263,10 @@ $ task default
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
The `output` option can also be specified by the `--output` or `-o` flags.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Interactive CLI application
|
||||
|
||||
When running interactive CLI applications inside Task they can sometimes behave weirdly, especially when the [output mode](#output-syntax) is set to something other than `interleaved` (the default), or when interactive apps are run in parallel with other tasks.
|
||||
@@ -1345,14 +1317,14 @@ tasks:
|
||||
|
||||
:::info
|
||||
|
||||
|
||||
Keep in mind that not all options are available in the [shell interpreter library](https://github.com/mvdan/sh) that Task uses.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Watch tasks
|
||||
|
||||
With the flags `--watch` or `-w` task will watch for file changes and run the task again. This requires the `sources` attribute to be given, so task knows which files to watch.
|
||||
|
||||
The default watch interval is 5 seconds, but it's possible to change it by either setting `interval: '500ms'` in the root of the Taskfile passing it as an argument like `--interval=500ms`.
|
||||
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
|
||||
Reference in New Issue
Block a user