mirror of
https://github.com/go-task/task.git
synced 2026-06-15 20:01:40 +00:00
chore(website): sync translations (#1145)
This commit is contained in:
@@ -71,6 +71,7 @@ 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.
|
||||
@@ -91,6 +92,7 @@ tasks:
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Environment variables
|
||||
|
||||
### Task
|
||||
@@ -124,10 +126,12 @@ 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:
|
||||
@@ -188,10 +192,12 @@ 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:
|
||||
@@ -234,10 +240,12 @@ 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.
|
||||
@@ -304,10 +312,12 @@ 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.
|
||||
@@ -389,10 +399,12 @@ 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
|
||||
@@ -525,10 +537,12 @@ 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
|
||||
@@ -583,6 +597,7 @@ 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).
|
||||
@@ -593,26 +608,33 @@ 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:
|
||||
@@ -766,10 +788,12 @@ $ 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
|
||||
@@ -874,13 +898,15 @@ 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][gotemplate] before executing them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
Task parse commands as [Go's template engine](https://golang.org/pkg/text/template/) 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:
|
||||
|
||||
@@ -1265,10 +1291,12 @@ $ 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.
|
||||
@@ -1319,10 +1347,12 @@ 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.
|
||||
@@ -1332,4 +1362,3 @@ The default watch interval is 5 seconds, but it's possible to change it by eithe
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
|
||||
Reference in New Issue
Block a user