Skip to content

Commit 1275ab1

Browse files
committed
v3.39.0
1 parent 0c05dcb commit 1275ab1

File tree

11 files changed

+383
-47
lines changed

11 files changed

+383
-47
lines changed

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## v3.39.0 - 2024-09-07
44

55
- Added
66
[Env Precedence Experiment](https://taskfile.dev/experiments/env-precedence)

Diff for: package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@go-task/cli",
3-
"version": "3.38.0",
3+
"version": "3.39.0",
44
"description": "A task runner / simpler Make alternative written in Go",
55
"scripts": {
66
"postinstall": "go-npm install",

Diff for: website/docs/changelog.mdx

+31
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@ sidebar_position: 14
55

66
# Changelog
77

8+
## v3.39.0 - 2024-09-07
9+
10+
- Added
11+
[Env Precedence Experiment](https://taskfile.dev/experiments/env-precedence)
12+
(#1038, #1633 by @vmaerten).
13+
- Added a CI lint job to ensure that the docs are updated correctly (#1719 by
14+
@vmaerten).
15+
- Updated minimum required Go version to 1.22 (#1758 by @pd93).
16+
- Expose a new `EXIT_CODE` special variable on `defer:` when a command finishes
17+
with a non-zero exit code (#1484, #1762 by @dorimon-1 and @andreynering).
18+
- Expose a new `ALIAS` special variable, which will contain the alias used to
19+
call the current task. Falls back to the task name. (#1764 by @DanStory).
20+
- Fixed `TASK_REMOTE_DIR` environment variable not working when the path was
21+
absolute. (#1715 by @vmaerten).
22+
- Added an option to declare an included Taskfile as flattened (#1704 by
23+
@vmaerten).
24+
- Added a new
25+
[`--completion` flag](https://taskfile.dev/installation/#setup-completions) to
26+
output completion scripts for various shells (#293, #1157 by @pd93).
27+
- This is now the preferred way to install completions.
28+
- The completion scripts in the `completion` directory
29+
[are now deprecated](https://taskfile.dev/deprecations/completion-scripts/).
30+
- Added the ability to
31+
[loop over a matrix of values](https://taskfile.dev/usage/#looping-over-a-matrix)
32+
(#1766, #1767, #1784 by @pd93).
33+
- Fixed a bug in fish completion where aliases were not displayed (#1781, #1782
34+
by @vmaerten).
35+
- Fixed panic when having a flattened included Taskfile that contains a
36+
`default` task (#1777, #1778 by @vmaerten).
37+
- Optimized file existence checks for remote Taskfiles (#1713 by @vmaerten).
38+
839
## v3.38.0 - 2024-06-30
940

1041
- Added `TASK_EXE` special variable (#1616, #1624 by @pd93 and @andreynering).

Diff for: website/versioned_docs/version-latest/changelog.mdx

+31
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@ sidebar_position: 14
55

66
# Changelog
77

8+
## v3.39.0 - 2024-09-07
9+
10+
- Added
11+
[Env Precedence Experiment](https://taskfile.dev/experiments/env-precedence)
12+
(#1038, #1633 by @vmaerten).
13+
- Added a CI lint job to ensure that the docs are updated correctly (#1719 by
14+
@vmaerten).
15+
- Updated minimum required Go version to 1.22 (#1758 by @pd93).
16+
- Expose a new `EXIT_CODE` special variable on `defer:` when a command finishes
17+
with a non-zero exit code (#1484, #1762 by @dorimon-1 and @andreynering).
18+
- Expose a new `ALIAS` special variable, which will contain the alias used to
19+
call the current task. Falls back to the task name. (#1764 by @DanStory).
20+
- Fixed `TASK_REMOTE_DIR` environment variable not working when the path was
21+
absolute. (#1715 by @vmaerten).
22+
- Added an option to declare an included Taskfile as flattened (#1704 by
23+
@vmaerten).
24+
- Added a new
25+
[`--completion` flag](https://taskfile.dev/installation/#setup-completions) to
26+
output completion scripts for various shells (#293, #1157 by @pd93).
27+
- This is now the preferred way to install completions.
28+
- The completion scripts in the `completion` directory
29+
[are now deprecated](https://taskfile.dev/deprecations/completion-scripts/).
30+
- Added the ability to
31+
[loop over a matrix of values](https://taskfile.dev/usage/#looping-over-a-matrix)
32+
(#1766, #1767, #1784 by @pd93).
33+
- Fixed a bug in fish completion where aliases were not displayed (#1781, #1782
34+
by @vmaerten).
35+
- Fixed panic when having a flattened included Taskfile that contains a
36+
`default` task (#1777, #1778 by @vmaerten).
37+
- Optimized file existence checks for remote Taskfiles (#1713 by @vmaerten).
38+
839
## v3.38.0 - 2024-06-30
940

1041
- Added `TASK_EXE` special variable (#1616, #1624 by @pd93 and @andreynering).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
slug: /deprecations/completion-scripts/
3+
---
4+
5+
# Completion Scripts
6+
7+
:::warning
8+
9+
This deprecation breaks the following functionality:
10+
11+
- Any direct references to the completion scripts in the Task git repository
12+
13+
:::
14+
15+
Direct use of the completion scripts in the `completion/*` directory of the
16+
[github.com/go-task/task][task] Git repository is deprecated. Any shell
17+
configuration that directly refers to these scripts will potentially break in
18+
the future as the scripts may be moved or deleted entirely. Any configuration
19+
should be updated to use the [new method for generating shell
20+
completions][completions] instead.
21+
22+
{/* prettier-ignore-start */}
23+
[completions]: ../installation.mdx#setup-completions
24+
[task]: https://github.com/go-task/task
25+
{/* prettier-ignore-end */}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
slug: '/experiments/env-precedence'
3+
---
4+
5+
# Env Precedence (#1038)
6+
7+
:::caution
8+
9+
All experimental features are subject to breaking changes and/or removal _at any
10+
time_. We strongly recommend that you do not use these features in a production
11+
environment. They are intended for testing and feedback only.
12+
13+
:::
14+
15+
:::warning
16+
17+
This experiment breaks the following functionality:
18+
19+
- environment variable will take precedence over OS environment variables
20+
21+
:::
22+
23+
:::info
24+
25+
To enable this experiment, set the environment variable:
26+
`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling
27+
experiments][enabling-experiments] for more information.
28+
29+
:::
30+
31+
Before this experiment, the OS variable took precedence over the task
32+
environment variable. This experiment changes the precedence to make the task
33+
environment variable take precedence over the OS variable.
34+
35+
Consider the following example:
36+
37+
```yml
38+
version: '3'
39+
40+
tasks:
41+
default:
42+
env:
43+
KEY: 'other'
44+
cmds:
45+
- echo "$KEY"
46+
```
47+
Running `KEY=some task` before this experiment, the output would be `some`, but
48+
after this experiment, the output would be `other`.
49+
50+
If you still want to get the OS variable, you can use the template function env
51+
like follow : `{{env "OS_VAR"}}`.
52+
53+
```yml
54+
version: '3'
55+
56+
tasks:
57+
default:
58+
env:
59+
KEY: 'other'
60+
cmds:
61+
- echo "$KEY"
62+
- echo {{env "KEY"}}
63+
```
64+
Running `KEY=some task`, the output would be `other` and `some`.
65+
66+
Like other variables/envs, you can also fall back to a given value using the
67+
default template function:
68+
```yml
69+
MY_ENV: '{{.MY_ENV | default "fallback"}}'
70+
```
71+
72+
{/* prettier-ignore-start */}
73+
[enabling-experiments]: ./experiments.mdx#enabling-experiments
74+
{/* prettier-ignore-end */}

Diff for: website/versioned_docs/version-latest/installation.mdx

+51-37
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ slug: /installation/
33
sidebar_position: 2
44
---
55

6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
69
# Installation
710

811
Task offers many installation methods. Check out the available methods below.
@@ -247,65 +250,76 @@ released binary.
247250

248251
## Setup completions
249252

250-
Download the autocompletion file corresponding to your shell.
251-
252-
[All completions are available on the Task repository](https://github.com/go-task/task/tree/main/completion).
253+
Some installation methods will automatically install completions too, but if
254+
this isn't working for you or your chosen method doesn't include them, you can
255+
run `task --completion <shell>` to output a completion script for any supported
256+
shell. There are a couple of ways these completions can be added to your shell
257+
config:
253258

254-
### Bash
259+
### Option 1. Load the completions in your shell's startup config (Recommended)
255260

256-
First, ensure that you installed bash-completion using your package manager.
261+
This method loads the completion script from the currently installed version of
262+
task every time you create a new shell. This ensures that your completions are
263+
always up-to-date.
257264

258-
Make the completion file executable:
265+
<Tabs values={[ {label: 'bash', value: '1'}, {label: 'zsh', value: '2'},
266+
{label: 'fish', value: '3'},
267+
{label: 'powershell', value: '4'}
268+
]}>
259269

260-
```shell
261-
chmod +x path/to/task.bash
270+
<TabItem value="1">
271+
```shell title="~/.bashrc"
272+
eval "$(task --completion bash)"
262273
```
274+
</TabItem>
263275

264-
After, add this to your `~/.bash_profile`:
265-
266-
```shell
267-
source path/to/task.bash
276+
<TabItem value="2">
277+
```shell title="~/.zshrc"
278+
eval "$(task --completion zsh)"
268279
```
280+
</TabItem>
269281

270-
### ZSH
271-
272-
Put the `_task` file somewhere in your `$FPATH`:
273-
274-
```shell
275-
mv path/to/_task /usr/local/share/zsh/site-functions/_task
282+
<TabItem value="3">
283+
```shell title="~/.config/fish/config.fish"
284+
task --completion fish | source
276285
```
286+
</TabItem>
277287

278-
Ensure that the following is present in your `~/.zshrc`:
279-
280-
```shell
281-
autoload -U compinit
282-
compinit -i
288+
<TabItem value="4">
289+
```powershell title="$PROFILE\Microsoft.PowerShell_profile.ps1"
290+
Invoke-Expression (&task --completion powershell)
283291
```
292+
</TabItem></Tabs>
284293

285-
ZSH version 5.7 or later is recommended.
294+
### Option 2. Copy the script to your shell's completions directory
286295

287-
### Fish
296+
This method requires you to manually update the completions whenever Task is
297+
updated. However, it is useful if you want to modify the completions yourself.
288298

289-
Move the `task.fish` completion script:
299+
<Tabs
300+
values={[
301+
{label: 'bash', value: '1'},
302+
{label: 'zsh', value: '2'},
303+
{label: 'fish', value: '3'}
304+
]}>
290305

306+
<TabItem value="1">
291307
```shell
292-
mv path/to/task.fish ~/.config/fish/completions/task.fish
308+
task --completion bash > /etc/bash_completion.d/task
293309
```
310+
</TabItem>
294311

295-
### PowerShell
296-
297-
Open your profile script with:
298-
299-
```powershell
300-
mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
301-
notepad $profile
312+
<TabItem value="2">
313+
```shell
314+
task --completion zsh > /usr/local/share/zsh/site-functions/_task
302315
```
316+
</TabItem>
303317

304-
Add the line and save the file:
305-
318+
<TabItem value="3">
306319
```shell
307-
Invoke-Expression -Command path/to/task.ps1
320+
task --completion fish > ~/.config/fish/completions/task.fish
308321
```
322+
</TabItem></Tabs>
309323

310324
{/* prettier-ignore-start */}
311325
[go]: https://golang.org/

Diff for: website/versioned_docs/version-latest/reference/schema.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ toc_max_heading_level: 5
88
# Schema Reference
99

1010
| Attribute | Type | Default | Description |
11-
| ---------- | ---------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11+
|------------|------------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1212
| `version` | `string` | | Version of the Taskfile. The current version is `3`. |
1313
| `output` | `string` | `interleaved` | Output mode. Available options: `interleaved`, `group` and `prefixed`. |
1414
| `method` | `string` | `checksum` | Default method in this Taskfile. Can be overridden in a task by task basis. Available options: `checksum`, `timestamp` and `none`. |
@@ -26,10 +26,11 @@ toc_max_heading_level: 5
2626
## Include
2727

2828
| Attribute | Type | Default | Description |
29-
| ---------- | --------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
|------------|-----------------------|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
3030
| `taskfile` | `string` | | The 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. |
3131
| `dir` | `string` | The parent Taskfile directory | The working directory of the included tasks when run. |
3232
| `optional` | `bool` | `false` | If `true`, no errors will be thrown if the specified file does not exist. |
33+
| `flatten` | `bool` | `false` | If `true`, the tasks from the included Taskfile will be available in the including Taskfile without a namespace. If a task with the same name already exists in the including Taskfile, an error will be thrown. |
3334
| `internal` | `bool` | `false` | Stops 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`. |
3435
| `aliases` | `[]string` | | Alternative names for the namespace of the included Taskfile. |
3536
| `vars` | `map[string]Variable` | | A set of variables to apply to the included Taskfile. |

Diff for: website/versioned_docs/version-latest/reference/templating.mdx

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,13 @@ engine. If you define a variable with the same name as a special variable, the
101101
special variable will be overridden.
102102

103103
| Var | Description |
104-
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
104+
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
105105
| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI. |
106106
| `CLI_FORCE` | A boolean containing whether the `--force` or `--force-all` flags were set. |
107+
| `CLI_SILENT` | A boolean containing whether the `--silent` flag was set. |
108+
| `CLI_VERBOSE` | A boolean containing whether the `--verbose` flag was set. |
107109
| `TASK` | The name of the current task. |
110+
| `ALIAS` | The alias used for the current task, otherwise matches `TASK`. |
108111
| `TASK_EXE` | The Task executable name or path. |
109112
| `ROOT_TASKFILE` | The absolute path of the root Taskfile. |
110113
| `ROOT_DIR` | The absolute path of the root Taskfile directory. |
@@ -115,6 +118,7 @@ special variable will be overridden.
115118
| `TIMESTAMP` | The date object of the greatest timestamp of the files listed in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
116119
| `TASK_VERSION` | The current version of task. |
117120
| `ITEM` | The value of the current iteration when using the `for` property. Can be changed to a different variable name using `as:`. |
121+
| `EXIT_CODE` | Available exclusively inside the `defer:` command. Contains the failed command exit code. Only set when non-zero. |
118122

119123
## Functions
120124

0 commit comments

Comments
 (0)