1
0
mirror of https://github.com/go-task/task.git synced 2025-02-01 13:17:56 +02:00
This commit is contained in:
Andrey Nering 2024-04-08 22:12:11 -03:00
parent 1d4bb7b5ef
commit 43d84560e5
27 changed files with 176 additions and 120 deletions

View File

@ -1,6 +1,6 @@
# Changelog
## Unreleased
## v3.36.0 - 2024-04-08
- Added support for
[looping over dependencies](https://taskfile.dev/usage/#looping-over-dependencies)

View File

@ -15,7 +15,7 @@ import (
const (
changelogSource = "CHANGELOG.md"
changelogTarget = "website/docs/changelog.md"
changelogTarget = "website/docs/changelog.mdx"
docsSource = "website/docs"
docsTarget = "website/versioned_docs/version-latest"
)

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@go-task/cli",
"version": "3.35.1",
"version": "3.36.0",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@ -1,6 +1,6 @@
{
"name": "@go-task/cli",
"version": "3.35.1",
"version": "3.36.0",
"description": "A task runner / simpler Make alternative written in Go",
"scripts": {
"postinstall": "go-npm install",

View File

@ -5,6 +5,26 @@ sidebar_position: 14
# Changelog
## v3.36.0 - 2024-04-08
- Added support for
[looping over dependencies](https://taskfile.dev/usage/#looping-over-dependencies)
(#1299, #1541 by @pd93).
- When using the
"[Remote Taskfiles](https://taskfile.dev/experiments/remote-taskfiles/)"
experiment, you are now able to use
[remote Taskfiles as your entrypoint](https://taskfile.dev/experiments/remote-taskfiles/#root-remote-taskfiles).
- `includes` in remote Taskfiles will now also resolve correctly (#1347 by
@pd93).
- When using the
"[Any Variables](https://taskfile.dev/experiments/any-variables/)"
experiments, templating is now supported in collection-type variables (#1477,
#1511, #1526 by @pd93).
- Fixed a bug where variables being passed to an included Taskfile were not
available when defining global variables (#1503, #1533 by @pd93).
- Improved support to customized colors by allowing 8-bit colors and multiple
ANSI attributes (#1576 by @pd93).
## v3.35.1 - 2024-03-04
- Fixed a bug where the `TASKFILE_DIR` variable was sometimes incorrect (#1522,

View File

@ -130,6 +130,7 @@ There are some special variables that is available on the templating system:
| `TASK` | The name of the current task. |
| `ROOT_TASKFILE` | The absolute path of the root Taskfile. |
| `ROOT_DIR` | The absolute path of the root Taskfile directory. |
| `TASKFILE` | The absolute path of the included Taskfile. |
| `TASKFILE_DIR` | The absolute path of the included Taskfile directory. |
| `USER_WORKING_DIR` | The absolute path of the directory `task` was called from. |
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
@ -153,6 +154,17 @@ Some environment variables can be overridden to adjust Task behavior.
| `TASK_COLOR_RED` | `31` | Color used for red. |
| `FORCE_COLOR` | | Force color output usage. |
All color variables are [ANSI color codes][ansi]. You can specify multiple codes
separated by a semicolon. For example: `31;1` will make the text bold and red.
Task also supports 8-bit color (256 colors). You can specify these colors by
using the sequence `38;2;R:G:B` for foreground colors and `48;2;R:G:B` for
background colors where `R`, `G` and `B` should be replaced with values between
0 and 255.
For convenience, we allow foreground colors to be specified using shorthand,
comma-separated syntax: `R,G,B`. For example, `255,0,0` is equivalent to
`38;2;255:0:0`.
## Taskfile Schema
| Attribute | Type | Default | Description |
@ -372,3 +384,7 @@ tasks:
| Attribute | Type | Default | Description |
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |
{/* prettier-ignore-start */}
[ansi]: https://en.wikipedia.org/wiki/ANSI_escape_code
{/* prettier-ignore-end */}

View File

@ -5,6 +5,52 @@ sidebar_position: 14
# Changelog
## v3.36.0 - 2024-04-08
- Added support for
[looping over dependencies](https://taskfile.dev/usage/#looping-over-dependencies)
(#1299, #1541 by @pd93).
- When using the
"[Remote Taskfiles](https://taskfile.dev/experiments/remote-taskfiles/)"
experiment, you are now able to use
[remote Taskfiles as your entrypoint](https://taskfile.dev/experiments/remote-taskfiles/#root-remote-taskfiles).
- `includes` in remote Taskfiles will now also resolve correctly (#1347 by
@pd93).
- When using the
"[Any Variables](https://taskfile.dev/experiments/any-variables/)"
experiments, templating is now supported in collection-type variables (#1477,
#1511, #1526 by @pd93).
- Fixed a bug where variables being passed to an included Taskfile were not
available when defining global variables (#1503, #1533 by @pd93).
- Improved support to customized colors by allowing 8-bit colors and multiple
ANSI attributes (#1576 by @pd93).
## v3.35.1 - 2024-03-04
- Fixed a bug where the `TASKFILE_DIR` variable was sometimes incorrect (#1522,
#1523 by @pd93).
- Added a new `TASKFILE` special variable that holds the root Taskfile path
(#1523 by @pd93).
- Fixed various issues related to running a Taskfile from a subdirectory (#1529,
#1530 by @pd93).
## v3.35.0 - 2024-02-28
- Added support for
[wildcards in task names](https://taskfile.dev/usage/#wildcard-arguments)
(#836, #1489 by @pd93).
- Added the ability to
[run Taskfiles via stdin](https://taskfile.dev/usage/#reading-a-taskfile-from-stdin)
(#655, #1483 by @pd93).
- Bumped minimum Go version to 1.21 (#1500 by @pd93).
- Fixed bug related to the `--list` flag (#1509, #1512 by @pd93, #1514, #1520 by
@pd93).
- Add mention on the documentation to the fact that the variable declaration
order is respected (#1510 by @kirkrodrigues).
- Improved style guide docs (#1495 by @iwittkau).
- Removed duplicated entry for `requires` on the API docs (#1491 by
@teatimeguest).
## v3.34.1 - 2024-01-27
- Fixed prompt regression on

View File

@ -72,21 +72,21 @@ install the extension.
Task uses [Docusaurus][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 `task docs` (requires `nodejs` & `yarn`). All content is written in
Markdown and is located in the `docs/docs` directory. All Markdown documents
by using `task website` (requires `nodejs` & `yarn`). All content is written in
Markdown and is located in the `website/docs` directory. All Markdown documents
should have an 80 character line wrap limit (enforced by Prettier).
When making a change, consider whether a change to the [Usage
Guide](/usage) 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).
When making a change, consider whether a change to the [Usage Guide](/usage) 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).
If you added a new field, command or flag, ensure that you add it to the
[API Reference](/api). New fields also need to be added to the
[JSON Schema][json-schema]. The descriptions for fields in the API reference and
the schema should match.
[API Reference](/api). New fields also need to be added to the [JSON
Schema][json-schema]. The descriptions for fields in the API reference and the
schema should match.
### Writing tests
@ -147,7 +147,7 @@ If you have questions, feel free to ask them in the `#help` forum channel on our
---
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[task]: https://github.com/go-task/task
[vscode-task]: https://github.com/go-task/vscode-task
[go]: https://go.dev
@ -157,11 +157,11 @@ If you have questions, feel free to ask them in the `#help` forum channel on our
[nodejs]: https://nodejs.org/en/
[yarn]: https://yarnpkg.com/
[docusaurus]: https://docusaurus.io
[json-schema]: https://github.com/go-task/task/blob/main/docs/static/schema.json
[json-schema]: https://github.com/go-task/task/blob/main/website/static/schema.json
[task-open-issues]: https://github.com/go-task/task/issues
[vscode-task-open-issues]: https://github.com/go-task/vscode-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
[conventional-commits]: https://www.conventionalcommits.org
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -26,8 +26,8 @@ main branch. To use a more recent version of Task, you will need to ensure that
your Taskfile uses the version 3 schema instead. A list of changes between
version 2 and version 3 are available in the [Task v3 Release Notes][v3.0.0].
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[v3.0.0]: https://github.com/go-task/task/releases/tag/v3.0.0
[v3.33.0]: https://github.com/go-task/task/releases/tag/v3.33.0
[deprecation-notice]: https://github.com/go-task/task/issues/1197
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -1,52 +0,0 @@
---
slug: /donate/
sidebar_position: 16
---
# Donate
If you find this project useful, you can consider donating by using one of the
channels listed below.
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] with the logo you want to be shown. Suspect businesses
(gambling, casinos, etc) won't be allowed, though.
## GitHub Sponsors
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use
the following links to do your donation. We suggest a 50/50 split to each
maintainer of the total amount you plan to donate to the project.
- [@andreynering](https://github.com/sponsors/andreynering)
- [@pd93](https://github.com/sponsors/pd93)
## Open Collective
If you prefer [Open Collective](https://opencollective.com/task) you can donate
by using these links:
- [$2 per month](https://opencollective.com/task/contribute/backer-4034/checkout)
- [$5 per month](https://opencollective.com/task/contribute/supporter-8404/checkout)
- [$20 per month](https://opencollective.com/task/contribute/sponsor-4035/checkout)
- [$50 per month](https://opencollective.com/task/contribute/sponsor-28775/checkout)
- [Custom value - One-time donation option supported](https://opencollective.com/task/donate)
## PayPal
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&currency_code=USD&source=url)
## PIX (Brazil only)
And if you're Brazilian, you can also donate to [@andreynering] via PIX by
[using this QR Code](/img/pix.png).
<!-- prettier-ignore-start -->
[@andreynering]: https://github.com/andreynering
<!-- prettier-ignore-end -->

View File

@ -340,7 +340,7 @@ When looping over a map we also make an additional `{{.KEY}}` variable availabe
that holds the string value of the map key. Remember that maps are unordered, so
the order in which the items are looped over is random.
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[enabling-experiments]: /experiments/#enabling-experiments
[slim-sprig]: https://go-task.github.io/slim-sprig/
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -22,9 +22,9 @@ This experiment breaks the following functionality:
:::info
To enable this experiment, set the environment variable: `TASK_X_FORCE=1`. Check
out [our guide to enabling experiments ][enabling-experiments] for more
information.
To enable this experiment, set the environment variable:
`TASK_X_GENTLE_FORCE=1`. Check out [our guide to enabling experiments
][enabling-experiments] for more information.
:::
@ -44,6 +44,6 @@ should replace all uses of the `--force` flag with `--force-all`. Alternatively,
if you want to adopt the new behavior, you can continue to use the `--force`
flag as you do now!
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[enabling-experiments]: /experiments/#enabling-experiments
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -48,16 +48,6 @@ tasks:
and you run `task my-remote-namespace:hello`, it will print the text: "Hello
from the remote Taskfile!" to your console.
## Root remote Taskfiles
You can also specify a remote Taskfile as the entrypoint for Task by using the
`--taskfile` flag. This means you don't need to have any Taskfile defined
locally at all. For example:
```shell
task --taskfile https://taskfile.dev hello
```
## Security
Running commands from sources that you do not control is always a potential
@ -90,10 +80,9 @@ flag. Before enabling this flag, you should:
Task currently supports both `http` and `https` URLs. However, the `http`
requests will not execute by default unless you run the task with the
`--insecure` flag. This is to protect you from accidentally running a remote
Taskfile that is hosted on and unencrypted connection. Sources that are not
protected by TLS are vulnerable to [man-in-the-middle
attacks][man-in-the-middle-attacks] and should be avoided unless you know what
you are doing.
Taskfile that is via an unencrypted connection. Sources that are not protected
by TLS are vulnerable to [man-in-the-middle attacks][man-in-the-middle-attacks]
and should be avoided unless you know what you are doing.
## Caching & Running Offline
@ -109,7 +98,7 @@ and look for a cached copy instead. This timeout can be configured by setting
the `--timeout` flag and specifying a duration. For example, `--timeout 5s` will
set the timeout to 5 seconds.
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[enabling-experiments]: /experiments/#enabling-experiments
[man-in-the-middle-attacks]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -37,6 +37,6 @@ information.
\{Short explanation of how users should migrate to the new behavior\}
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[enabling-experiments]: /experiments/#enabling-experiments
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -95,7 +95,7 @@ this work. Constructive comments and contributions are very welcome!
- [mvdan/sh#93](https://github.com/mvdan/sh/issues/93)
- [mvdan/sh#97](https://github.com/mvdan/sh/issues/97)
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[git-bash]: https://gitforwindows.org/
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/install
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -29,23 +29,23 @@ so you also have that option if you prefer:
brew install go-task
```
### Tea
### pkgx
If you're on macOS or Linux and have [tea][tea] installed, getting Task is as
If you're on macOS or Linux and have [pkgx](https://pkgx.sh/) installed, getting Task is as
simple as running:
```shell
tea task
pkgx task
```
or, if you have tea’s magic enabled:
or, if you have pkgx integration enabled:
```shell
task
```
This installation method is community owned. After a new release of Task, they
are automatically released by tea in a minimum of time.
are automatically released by pkgx in a minimum of time.
### Snap
@ -290,7 +290,7 @@ Add the line and save the file:
Invoke-Expression -Command path/to/task.ps1
```
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[go]: https://golang.org/
[snapcraft]: https://snapcraft.io/task
[homebrew]: https://brew.sh/
@ -300,4 +300,4 @@ Invoke-Expression -Command path/to/task.ps1
[choco]: https://chocolatey.org/
[scoop]: https://scoop.sh/
[tea]: https://tea.xyz/
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -32,7 +32,7 @@ To get autocompletion and validation for your Taskfile, see the
This was initially created by @KROSF in
[this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895) and
is now officially maintained in
[this file](https://github.com/go-task/task/blob/main/docs/static/schema.json)
[this file](https://github.com/go-task/task/blob/main/website/static/schema.json)
and made available at https://taskfile.dev/schema.json. This schema can be used
to validate Taskfiles and provide autocompletion in many code editors:

View File

@ -2,13 +2,13 @@
slug: /
sidebar_position: 1
title: Home
hide_title: true
---
# Task
<div align="center">
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
<img id="logo" src="/img/logo.svg" height="250px" width="250px" />
</div>
<br />
Task is a task runner / build tool that aims to be simpler and easier to use
than, for example, [GNU Make][make].
@ -50,7 +50,7 @@ guide to check the full schema documentation and Task features.
of files haven't changed since last run (based either on its timestamp or
content).
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[make]: https://www.gnu.org/software/make/
[go]: https://go.dev/
[yaml]: http://yaml.org/
@ -58,4 +58,4 @@ guide to check the full schema documentation and Task features.
[snapcraft]: https://snapcraft.io/
[scoop]: https://scoop.sh/
[sh]: https://github.com/mvdan/sh
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -61,7 +61,7 @@ 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.
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[goreleaser]: https://goreleaser.com/
[homebrewtap]: https://github.com/go-task/homebrew-tap
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb
@ -69,4 +69,4 @@ If you think its Task version is outdated, open an issue to let us know.
[snappackage]: https://github.com/go-task/snap
[snapcraftyaml]: https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2
[snapcraftdashboard]: https://snapcraft.io/task/releases
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -255,9 +255,9 @@ The variable priority order was also different:
3. Task variables
4. `Taskvars.yml` variables
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[deprecate-version-2-schema]: /deprecations/version-2-schema/
[output]: /usage#output-syntax
[ignore_errors]: /usage#ignore-errors
[includes]: /usage#including-other-taskfiles
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -16,7 +16,7 @@ translations, please ask for access on the [#translations channel on our Discord
server][discord]. If a given language is not being shown to Crowdin yet, just
ask and we can configure it.
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[crowdin]: https://crowdin.com/project/taskfile
[discord]: https://discord.gg/6TY36E39UK
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}

View File

@ -1197,6 +1197,43 @@ tasks:
- echo 'bar'
```
### Looping over dependencies
All of the above looping techniques can also be applied to the `deps` property.
This allows you to combine loops with concurrency:
```yaml
version: '3'
tasks:
default:
deps:
- for: [foo, bar]
task: my-task
vars:
FILE: '{{.ITEM}}'
my-task:
cmds:
- echo '{{.FILE}}'
```
It is important to note that as `deps` are run in parallel, the order in which
the iterations are run is not guaranteed and the output may vary. For example,
the output of the above example may be either:
```shell
foo
bar
```
or
```shell
bar
foo
```
## Forwarding CLI arguments to commands
If `--` is given in the CLI, all following parameters are added to a special
@ -1917,6 +1954,6 @@ if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
{/* prettier-ignore-start */}
[gotemplate]: https://golang.org/pkg/text/template/
<!-- prettier-ignore-end -->
{/* prettier-ignore-end */}