Compare commits

...

22 Commits

Author SHA1 Message Date
Andrey Nering
7c221ef999 v3.32.0 2023-11-29 22:40:04 -03:00
Pete Davison
ec35d43677 feat: support negative globs (#1324)
Co-authored-by: Andrey Nering <andrey@nering.com.br>
2023-11-29 22:38:12 -03:00
task-bot
a7958c0e3b chore: sync translations (#1404) 2023-11-22 09:52:01 -03:00
Pete Davison
546a4d7e46 feat: prefer remote taskfiles over cached ones (#1345)
* feat: prefer remote taskfiles over cached ones

* feat: implemented cache on network timeout

* feat: --download always downloads, but never executes tasks

* feat: --timeout flag

* fix: bug with timeout error handling

* chore: changelog
2023-11-17 14:51:10 -06:00
Andrey Nering
834babe0ef chore: add changelog + improve code for #1368 2023-11-15 22:38:53 -03:00
Alexander Mancevice
8355f16809 feat: add --no-status flag (#1368)
disables status check when running with `--list` `--json` options
2023-11-15 22:31:02 -03:00
dependabot[bot]
db2414402f chore(deps): bump golang.org/x/term from 0.13.0 to 0.14.0 (#1395) 2023-11-15 21:42:36 -03:00
dependabot[bot]
c7f80a3be4 chore(deps): bump golang.org/x/sync from 0.4.0 to 0.5.0 (#1396) 2023-11-15 21:39:43 -03:00
dependabot[bot]
b883a25c9a chore(deps): bump github.com/fatih/color from 1.15.0 to 1.16.0 (#1397) 2023-11-15 21:39:20 -03:00
task-bot
7fbded2b13 chore: sync translations (#1399) 2023-11-15 21:38:07 -03:00
task-bot
fb506acc27 chore: sync translations (#1389) 2023-11-07 11:15:18 -03:00
Andrey Nering
a8d3a69013 chore: update discord link on issue template
#1390
2023-11-07 11:13:35 -03:00
Iain Majer
30a2415ac8 Add silent to for_call schema (#1386)
* Add silent to for_call schema

* Update Changelog
2023-10-30 12:50:20 +00:00
Andrey Nering
b681ef9868 fix(platforms): do not run dynamic vars for other platforms (#1377) 2023-10-22 00:42:26 +00:00
task-bot
38efad5aa2 chore: sync translations (#1376) 2023-10-21 21:40:52 -03:00
Andrey Nering
6de3be1384 refactor(merge): use constant 2023-10-21 21:10:42 -03:00
Andrey Nering
781e55fce9 chore(website): remove gold sponsors section 2023-10-21 18:59:22 -03:00
task-bot
9b0de2e72e chore: sync translations (#1371) 2023-10-18 09:51:47 -03:00
dependabot[bot]
d4f7216256 chore(deps): bump @babel/traverse from 7.18.2 to 7.23.2 in /docs (#1374) 2023-10-18 09:51:17 -03:00
Andrey Nering
2842ae7fb5 chore(docs) add missing watch: true to example 2023-10-11 09:40:14 -03:00
task-bot
75aa066d9c chore: sync translations (#1367) 2023-10-07 22:10:49 -03:00
Andrey Nering
244aa93b3a chore(taskfile): add task to install goreleaser 2023-10-07 19:38:16 -03:00
81 changed files with 923 additions and 421 deletions

View File

@@ -4,7 +4,7 @@ contact_links:
url: https://github.com/go-task/vscode-task
about: Issues related to the Visual Studio Code extension should be opened here.
- name: Help forum on Discord
url: https://discord.com/channels/974121106208354339/1025054680289660989
url: https://discord.gg/6TY36E39UK
about: 'The Discord #help channel is the best way to get help from the community.'
- name: Questions, Ideas and General Discussions
url: https://github.com/go-task/task/discussions

View File

@@ -1,10 +1,27 @@
# Changelog
## v3.32.0 - 2023-11-29
- Added ability to exclude some files from `sources:` by using `exclude:` (#225,
#1324 by @pd93 and @andreynering).
- The
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
now prefers remote files over cached ones by default (#1317, #1345 by @pd93).
- Added `--timeout` flag to the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
(#1317, #1345 by @pd93).
- Fix bug where dynamic `vars:` and `env:` were being executed when they should
actually be skipped by `platforms:` (#1273, #1377 by @andreynering).
- Fix `schema.json` to make `silent` valid in `cmds` that use `for` (#1385,
#1386 by @iainvm).
- Add new `--no-status` flag to skip expensive status checks when running
`task --list --json` (#1348, #1368 by @amancevice).
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
(#1344 by @pd93).
(#1317, #1344 by @pd93).
- Add ability to set `watch: true` in a task to automatically run it in watch
mode (#231, #1361 by @andreynering).
- Fixed a bug on the watch mode where paths that contained `.git` (like
@@ -18,8 +35,8 @@
exists to detect recursive calls, but will be removed in favor of a better
algorithm soon (#1321, #1332).
- Fixed templating on descriptions on `task --list` (#1343 by @blackjid).
- Fixed a bug where precondition errors were incorrectly being printed when
task execution was aborted (#1337, #1338 by @sylv-io).
- Fixed a bug where precondition errors were incorrectly being printed when task
execution was aborted (#1337, #1338 by @sylv-io).
## v3.30.1 - 2023-09-14

View File

@@ -13,17 +13,3 @@
<a href="https://taskfile.dev/installation/">Installation</a> | <a href="https://taskfile.dev/usage/">Documentation</a> | <a href="https://twitter.com/taskfiledev">Twitter</a> | <a href="https://fosstodon.org/@task">Mastodon</a> | <a href="https://discord.gg/6TY36E39UK">Discord</a>
</p>
</div>
## Gold Sponsors
<div align="center">
| [Appwrite][appwrite] |
| ------------------------------------------------------ |
| [![Appwrite](/docs/static/img/appwrite.svg)][appwrite] |
</div>
<!-- prettier-ignore-start -->
[appwrite]: https://appwrite.io/?utm_source=task_github&utm_medium=social&utm_campaign=task_oss_fund
<!-- prettier-ignore-end -->

View File

@@ -113,11 +113,16 @@ tasks:
GO_PACKAGES:
sh: go list ./...
test-release:
goreleaser:test:
desc: Tests release process without publishing
cmds:
- goreleaser --snapshot --clean
goreleaser:install:
desc: Installs goreleaser
cmds:
- go install github.com/goreleaser/goreleaser@latest
release:
desc: Prepare the project for a new release
cmds:

View File

@@ -53,6 +53,7 @@ var flags struct {
listJson bool
taskSort string
status bool
noStatus bool
insecure bool
force bool
forceAll bool
@@ -74,6 +75,7 @@ var flags struct {
experiments bool
download bool
offline bool
timeout time.Duration
}
func main() {
@@ -115,6 +117,7 @@ func run() error {
pflag.BoolVarP(&flags.listJson, "json", "j", false, "Formats task list as JSON.")
pflag.StringVar(&flags.taskSort, "sort", "", "Changes the order of the tasks when listed. [default|alphanumeric|none].")
pflag.BoolVar(&flags.status, "status", false, "Exits with non-zero exit code if any of the given tasks is not up-to-date.")
pflag.BoolVar(&flags.noStatus, "no-status", false, "Ignore status when listing tasks as JSON")
pflag.BoolVar(&flags.insecure, "insecure", false, "Forces Task to download Taskfiles over insecure connections.")
pflag.BoolVarP(&flags.watch, "watch", "w", false, "Enables watch of the given task.")
pflag.BoolVarP(&flags.verbose, "verbose", "v", false, "Enables verbose mode.")
@@ -148,6 +151,7 @@ func run() error {
if experiments.RemoteTaskfiles {
pflag.BoolVar(&flags.download, "download", false, "Downloads a cached version of a remote Taskfile.")
pflag.BoolVar(&flags.offline, "offline", false, "Forces Task to only use local or cached Taskfiles.")
pflag.DurationVar(&flags.timeout, "timeout", time.Second*10, "Timeout for downloading remote Taskfiles.")
}
pflag.Parse()
@@ -233,6 +237,7 @@ func run() error {
Insecure: flags.insecure,
Download: flags.download,
Offline: flags.offline,
Timeout: flags.timeout,
Watch: flags.watch,
Verbose: flags.verbose,
Silent: flags.silent,
@@ -254,7 +259,7 @@ func run() error {
TaskSorter: taskSorter,
}
listOptions := task.NewListOptions(flags.list, flags.listAll, flags.listJson)
listOptions := task.NewListOptions(flags.list, flags.listAll, flags.listJson, flags.noStatus)
if err := listOptions.Validate(); err != nil {
return err
}
@@ -268,6 +273,12 @@ func run() error {
return err
}
// If the download flag is specified, we should stop execution as soon as
// taskfile is downloaded
if flags.download {
return nil
}
if listOptions.ShouldListTasks() {
foundTasks, err := e.ListTasks(listOptions)
if err != nil {
@@ -296,9 +307,7 @@ func run() error {
}
// If there are no calls, run the default task instead
// Unless the download flag is specified, in which case we want to download
// the Taskfile and do nothing else
if len(calls) == 0 && !flags.download {
if len(calls) == 0 {
calls = append(calls, taskfile.Call{Task: "default", Direct: true})
}

View File

@@ -5,11 +5,28 @@ sidebar_position: 14
# Changelog
## v3.32.0 - 2023-11-29
- Added ability to exclude some files from `sources:` by using `exclude:` ([#225](https://github.com/go-task/task/issues/225),
[#1324](https://github.com/go-task/task/issues/1324) by [@pd93](https://github.com/pd93) and [@andreynering](https://github.com/andreynering)).
- The
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
now prefers remote files over cached ones by default ([#1317](https://github.com/go-task/task/issues/1317), [#1345](https://github.com/go-task/task/issues/1345) by [@pd93](https://github.com/pd93)).
- Added `--timeout` flag to the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
([#1317](https://github.com/go-task/task/issues/1317), [#1345](https://github.com/go-task/task/issues/1345) by [@pd93](https://github.com/pd93)).
- Fix bug where dynamic `vars:` and `env:` were being executed when they should
actually be skipped by `platforms:` ([#1273](https://github.com/go-task/task/issues/1273), [#1377](https://github.com/go-task/task/issues/1377) by [@andreynering](https://github.com/andreynering)).
- Fix `schema.json` to make `silent` valid in `cmds` that use `for` ([#1385](https://github.com/go-task/task/issues/1385),
[#1386](https://github.com/go-task/task/issues/1386) by [@iainvm](https://github.com/iainvm)).
- Add new `--no-status` flag to skip expensive status checks when running
`task --list --json` ([#1348](https://github.com/go-task/task/issues/1348), [#1368](https://github.com/go-task/task/issues/1368) by [@amancevice](https://github.com/amancevice)).
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
([#1317](https://github.com/go-task/task/issues/1317), [#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch
mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like
@@ -23,8 +40,8 @@ sidebar_position: 14
exists to detect recursive calls, but will be removed in favor of a better
algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when
task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
- Fixed a bug where precondition errors were incorrectly being printed when task
execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14

View File

@@ -19,7 +19,9 @@ the website homepage and on the GitHub repository README. Make contact with
## GitHub Sponsors
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use
the following links to do your donation:
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)

View File

@@ -74,16 +74,17 @@ you are doing.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still
need to be able to run your tasks, you are able to use the `--download` flag to
store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the
internet and cached locally. If for whatever reason, you lose access to the
internet, you will still be able to run your tasks by specifying the `--offline`
flag. This will tell Task to use the latest cached version of the file instead
of trying to download it. You are able to use the `--download` flag to update
the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use
your local copy instead of downloading the remote file. You can force Task to
work offline by using the `--offline` flag. This will prevent Task from making
any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds
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 -->
[remote-taskfiles-experiment]: https://github.com/go-task/task/issues/1317

View File

@@ -50,16 +50,6 @@ 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).
## Gold Sponsors
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
[make]: https://www.gnu.org/software/make/
[go]: https://go.dev/

View File

@@ -642,11 +642,27 @@ tasks:
- public/bundle.css
```
`sources` and `generates` can be files or file patterns. When given, Task will
`sources` and `generates` can be files or glob 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 `Task "js" is up to date`.
If you prefer this check to be made by the modification timestamp of the files,
`exclude:` can also be used to exclude files from fingerprinting.
Sources are evaluated in order, so `exclude:` must come after the positive
glob it is negating.
```yaml
version: '3'
tasks:
css:
sources:
- mysources/**/*.css
- exclude: mysources/ignoreme.css
generates:
- public/bundle.css
```
If you prefer these check to be made by the modification timestamp of the files,
instead of its checksum (content), just set the `method` property to
`timestamp`.
@@ -1001,9 +1017,9 @@ This works for all types of variables.
## Looping over values
As of v3.28.0, Task allows you to loop over certain values and execute a
command for each. There are a number of ways to do this depending on the type
of value you want to loop over.
As of v3.28.0, Task allows you to loop over certain values and execute a command
for each. There are a number of ways to do this depending on the type of value
you want to loop over.
### Looping over a static list
@@ -1043,9 +1059,8 @@ match that glob.
Source paths will always be returned as paths relative to the task directory. If
you need to convert this to an absolute path, you can use the built-in
`joinPath` function.
There are some [special variables](/api/#special-variables) that you may find
useful for this.
`joinPath` function. There are some [special variables](/api/#special-variables)
that you may find useful for this.
```yaml
version: '3'
@@ -1817,6 +1832,7 @@ interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ Companies who donate at least $50/month will be featured as a "Gold Sponsor" in
## GitHub Sponsors
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use the following links to do your donation:
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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -37,16 +37,6 @@ The above example is just the start, you can take a look at the [usage](/usage)
- 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
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,6 @@ andreynering:
image_url: https://github.com/andreynering.png
pd93:
name: Pete Davison
title: Maintainer of Task
title: Mainteneur de Task
url: https://github.com/pd93
image_url: https://github.com/pd93.png

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -9,7 +9,7 @@ Certains travaux d'amélioration de l'écosystème Task sont réalisés par la c
## Traductions
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
Nous utilisons [Crowdin](https://crowdin.com/project/taskfile) pour traduire nos documents.
## Intégrations

View File

@@ -3,10 +3,10 @@ slug: /deprecations/
sidebar_position: 7
---
# Deprecations
# Dépréciations
As Task evolves, it occasionally outgrows some of its functionality. This can be because they are no longer useful, because another feature has replaced it or because of a change in the way that Task works internally.
Au fur et à mesure que Task évolue, certaines de ses fonctionnalités peuvent se montrer obsolètes. Cela peut être dû au fait qu'elles ne sont plus utiles, parce qu'une autre fonctionnalité l'a remplacée ou à cause d'un changement dans la façon dont la tâche fonctionne.
When this happens, we mark the functionality as deprecated. This means that it will be removed in a future version of Task. This functionality will continue to work until that time, but we strongly recommend that you do not implement this functionality in new Taskfiles and make a plan to migrate away from it as soon as possible.
Lorsque cela se produit, nous marquons la fonctionnalité comme obsolète. Cela signifie que sera supprimé dans une future version de Task. La fonctionnalité continuera de fonctionner en attendant, mais il vous est fortement recommandé de ne plus l'utiliser et de planifier un plan de migration pour changer toutes les tâches pouvant l'utiliser.
You can view a full list of active deprecations in the "Deprecations" section of the sidebar.
Vous pouvez afficher une liste complète des dépréciations actives dans la section "Dépréciations" de la barre latérale.

View File

@@ -6,12 +6,12 @@ sidebar_position: -1 #Always push to the top
draft: true #Hide in production
---
# {Name of Deprecated Feature}
# {Nom de la fonctionnalité obsolète}
- Issue: [#{issue}](https://github.com/go-task/task/issues/{issue})
- Breaks:
- {list any existing functionality that will be broken by this experiment}
- {lister toutes les fonctionnalités qui vont être brisées par ce changement}
{Short description of the feature/behavior and why it is being deprecated}
{Description rapide de la fonctionnalité et de la raison de sa dépréciation}
{Short explanation of any replacement features/behaviors and how users should migrate to it}
{Courte explication des fonctionnalités à utiliser à la place, et comment les utilisateurs peuvent migrer vers cette autre fonctionnalité}

View File

@@ -13,7 +13,7 @@ Les entreprises qui font un don d'au moins 50$/mois seront présentées comme un
## Sponsors GitHub
La façon préférée de faire un don aux mainteneurs du projet est d'utiliser les sponsors GitHub. Utilisez simplement le lien suivant pour faire votre don :
La façon préférée de faire un don aux mainteneurs du projet est d'utiliser les sponsors GitHub. Vous pouvez utiliser le lien suivant pour faire votre don. Nous suggérons de donner 50% à chaque mainteneur du montant total que vous prévoyez de donner.
- [@andreynering](https://github.com/sponsors/andreynering)
- [@pd93](https://github.com/sponsors/pd93)

View File

@@ -3,23 +3,23 @@ slug: /experiments/
sidebar_position: 6
---
# Experiments
# Expérimentations
:::caution
All experimental features are subject to breaking changes and/or removal _at any time_. We strongly recommend that you do not use these features in a production environment. They are intended for testing and feedback only.
Toutes les fonctionnalités expérimentales sont sujettes à des changements brisant la fonctionnalité et/ou à la suppression de cette dernière _à tout moment _. Nous vous recommandons fortement de ne pas utiliser ces fonctionnalités dans en production. Ils sont seulement destinés à être testés et obtenir des retours dessus.
:::
In order to allow Task to evolve quickly, we roll out breaking changes to minor versions behind experimental flags. This allows us to gather feedback on breaking changes before committing to a major release. This document describes the current set of experimental features and their status in the [workflow](#workflow).
Afin de permettre à Task d'évoluer rapidement, nous déployons des changements cassants sur des versions mineures activables par des options expérimentales. Cela nous permet d'obtenir des retours sur des changements brisants des fonctionnalités avant de les livrer dans une version majeure. Ce document décrit l'ensemble actuel de fonctionnalités expérimentales et leur statut dans le [workflow](#workflow).
You can view a full list of active experiments in the "Experiments" section of the sidebar.
Vous pouvez consulter une liste complète des expérimentations en cours dans la section "Expérimentations" de la barre latérale .
You can enable an experimental feature by:
Vous pouvez activer une fonctionnalité expérimentale par:
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
1. Utiliser la variable d'environnement pertinente devant une commande Task. Par exemple, `TASK_X_{FEATURE}=1 task {my-task}`. Ceci est prévu pour faire appel à une expérimentation durant une seule commande Task afin de tester une fonctionnalité expérimentale.
1. Utiliser la variable d'environnement pertinente dans vos "dotfiles" (par exemple `.bashrc`, `.zshrc` etc.). Ceci est destiné à l'activation permanente des fonctionnalités expérimentales dans votre environnement.
1. Création d'un fichier `.env` dans le même répertoire que votre fichier Taskfile contenant les variables d'environnement pertinentes pour vos tests. Par exemple :
```shell
# .env

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -37,16 +37,6 @@ L'exemple ci-dessus n'est que le début, vous pouvez jeter un coup d'œil au [gu
- Multi-plateforme : alors que la plupart des outils de compilation ne fonctionnent bien que sous Linux ou macOS, Task prend également en charge Windows grâce à [cet interpréteur shell pour Go][sh].
- Idéal pour la génération de code : vous pouvez facilement [empêcher une tâche de s'exécuter](/usage#prevent-unnecessary-work) si un ensemble donné de fichiers n'ont pas changé depuis le dernier lancement (basé soit sur son horodatage soit son contenu).
## Sponsors Or
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -208,10 +208,10 @@ tasks:
C'est aussi fait automatiquement quand vous incluez des Taskfiles.
## Prefer external scripts over complex multi-line commands
## Préférer les scripts externes à des commandes complexes à plusieurs lignes
```yaml
# bad
# Incorrect
version: '3'
tasks:
@@ -223,7 +223,7 @@ tasks:
echo "some other complex logic"
done'
# good
# Correct
version: '3'
tasks:

View File

@@ -3,28 +3,28 @@ slug: /taskfile-versions/
sidebar_position: 5
---
# Taskfile Versions
# Versions Taskfile
The Taskfile syntax and features changed with time. This document explains what changed on each version and how to upgrade your Taskfile.
La syntaxe et les fonctionnalités du fichier Taskfile changent avec le temps. Ce document explique quels sont les changments pour chacune des versions et comment vous pouvez mettre à jour votre Taskfile.
## What the Taskfile version mean
## Qu'est-ce que la version de Taskfile signifie
The Taskfile version follows the Task version. E.g. the change to Taskfile version `2` means that Task `v2.0.0` should be release to support it.
La version de Taskfile suit la version de Task. Par exemple : Le changement pour la version `2` dans Taskfile signifie que la version `v2.0.0` de Task doit être publiée pour pouvoir le supporter.
The `version:` key on Taskfile accepts a semver string, so either `2`, `2.0` or `2.0.0` is accepted. If you choose to use `2.0` Task will not enable future `2.1` features, but if you choose to use `2`, then any `2.x.x` features will be available, but not `3.0.0+`.
Le paramètrre `version:` dans Taskfile accepte une version suivant la nomenclature semver. Donc `2`, `2.0` et `2.0.0` sont acceptés. Si vous choisissez d'utiliser la version `2.0`, Task ne va pas activer les fonctionnalités des versions `2.1` et celles d'après. Mais si vous choississez d'utiliser la version `2`, alors toutes les fonctionnalités des versions `2.x.x` seront disponibles, et non celles des versions `3.0.0` et celles d'après.
## Version 3 ![latest](https://img.shields.io/badge/latest-brightgreen)
## Version 3 ![Dernier](https://img.shields.io/badge/latest-brightgreen)
These are some major changes done on `v3`:
Voici quelques modifications majeures effectuées sur `v3`:
- Task's output will now be colored
- Added support for `.env` like files
- Added `label:` setting to task so one can override how the task name appear in the logs
- A global `method:` was added to allow setting the default method, and Task's default changed to `checksum`
- Two magic variables were added when using `status:`: `CHECKSUM` and `TIMESTAMP` which contains, respectively, the XXH3 checksum and greatest modification timestamp of the files listed on `sources:`
- Also, the `TASK` variable is always available with the current task name
- CLI variables are always treated as global variables
- Added `dir:` option to `includes` to allow choosing on which directory an included Taskfile will run:
- Les logs de Task dans le terminal sont colorés
- Ajout du support des fichiers `.env` et similaires
- Ajout du paramètre `label:` dans les tâches pour que l'on puisse renommer la tâche dans les logs
- Le paramètre global `method:` a été ajouté pour permettre de définir la méthode par défault, et la valeur par défaut de Task a été changée pour `checksum`
- Deux variables magiques ont été ajoutées lors de l'utilisation de `status:`: `CHECKSUM` et `TIMESTAMP` qui contiennent respectivement le checksum XXH3 et le plus récent timestamp de modification des fichiers répertoriés dans `sources:`
- Aussi, la variable `TASK` est toujours disponible avec le nom de la tâche courante
- Les variables CLI sont toujours traitées comme des variables globales
- Ajout de l'option `dir:` dans `includes` pour permettre de choisir dans quel dossier un Taskfile doit être exécuté :
```yaml
includes:
@@ -33,7 +33,7 @@ includes:
dir: ./docs
```
- Implemented short task syntax. All below syntaxes are equivalent:
- Implémentation de syntaxes courtes. Toutes les syntaxes ci-dessous sont équivalentes:
```yaml
version: '3'
@@ -59,21 +59,21 @@ tasks:
print: echo "Hello, World!"
```
- There was a major refactor on how variables are handled. They're now easier to understand. The `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.
- Environment variables
- Global + CLI variables
- Call variables
- Task variables
- Il y a eu une réécriture majeure sur la manière dont les variables sont gérées. C'est maintenant plus simple à comprendre. Les paramètres `expansions:` ont été retirées vu qu'ils n'étaient plus nécessaires. C'est l'ordre dans lequel Task va traiter les variables, chaque niveau peut voir les variables définies par la précédente et les remplacer.
- Variables d'environnement
- Variables globales + CLI
- Variables d'appel
- Variables Task
## Version 2.6
:::caution
v2 schema support is [deprecated][deprecate-version-2-schema] and will be removed in a future release.
Le support du schéma v2 est [déprécié][deprecate-version-2-schema] et sera retiré dans une future version.
:::
Version 2.6 comes with `preconditions` stanza in tasks.
La version 2.6 vient avec des `preconditions` dans les tâches.
```yaml
version: '2'
@@ -86,17 +86,17 @@ tasks:
- aws s3 cp .env s3://myenvironment
```
Please check the [documentation][includes]
Veuillez consulter la [documentation][includes]
## Version 2.2
:::caution
v2 schema support is [deprecated][deprecate-version-2-schema] and will be removed in a future release.
Le support du schéma v2 est [déprécié][deprecate-version-2-schema] et sera retiré dans une future version.
:::
Version 2.2 comes with a global `includes` options to include other Taskfiles:
La version 2.2 est fournie avec une option globale `includes` pour inclure d'autres Taskfiles :
```yaml
version: '2'
@@ -110,11 +110,11 @@ includes:
:::caution
v2 schema support is [deprecated][deprecate-version-2-schema] and will be removed in a future release.
Le support du schéma v2 est [déprécié][deprecate-version-2-schema] et sera retiré dans une future version.
:::
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):
La version 2.1 inclut une option globale `output` permettant d'avoir plus de contrôle sur la manière dont les logs sont affichés dans la console (voir la [documentation][output] pour plus d'informations):
```yaml
version: '2'
@@ -128,7 +128,7 @@ tasks:
prefix: server
```
From this version it's also possible to ignore errors of a command or task (check documentation [here][ignore_errors]):
À partir de cette version, il est également possible d'ignorer les erreurs d'une commande ou d'une tâche (vérifiez la documentation [ici][ignore_errors] ) :
```yaml
version: '2'
@@ -151,11 +151,11 @@ tasks:
:::caution
v2 schema support is [deprecated][deprecate-version-2-schema] and will be removed in a future release.
Le support du schéma v2 est [déprécié][deprecate-version-2-schema] et sera retiré dans une future version.
:::
At version 2, we introduced the `version:` key, to allow us to evolve Task with new features without breaking existing Taskfiles. The new syntax is as follows:
À la version 2, nous avons introduit le paramètre `version:` pour nous permettre d'évoluer vers de nouvelles fonctionnalités avec sans casser les fichiers de tâches existants. La nouvelle syntaxe est la suivante:
```yaml
version: '2'
@@ -166,7 +166,7 @@ tasks:
- echo "Hello, World!"
```
Version 2 allows you to write global variables directly in the Taskfile, if you don't want to create a `Taskvars.yml`:
La version 2 vous permet d'écrire des variables globales directement dans le fichier Taskfile, si vous ne voulez pas créer un fichier `Taskvars.yml`:
```yaml
version: '2'
@@ -180,15 +180,15 @@ tasks:
- echo "{{.GREETING}}"
```
The variable priority order changed to the following:
A présent, l'ordre de priorité des variables est :
1. Task variables
2. Call variables
3. Taskfile variables
4. Taskvars file variables
5. Environment variables
1. Variables Task
2. Variables d'appel
3. Variables Taskfile
4. Variables du fichier Taskvars
5. Variables d'environnement
A new global option was added to configure the number of variables expansions (which default to 2):
Une nouvelle option globale a été ajoutée pour configurer le nombre d'extensions de variables (par défaut 2):
```yaml
version: '2'
@@ -212,11 +212,11 @@ tasks:
:::caution
v1 schema support was removed in Task >= v3.0.0.
Le support du schéma v1 a été supprimé de Task >= v3.0.0.
:::
In the first version of the `Taskfile`, the `version:` key was not available, because the tasks was in the root of the YAML document. Like this:
Dans la première version du `Taskfile`, le champ `version:` n'était pas disponible, parce que les tâches étaient à la racine du document YAML. Comme ceci:
```yaml
echo:
@@ -224,12 +224,12 @@ echo:
- echo "Hello, World!"
```
The variable priority order was also different:
L'ordre de priorité de la variable était également différent :
1. Call variables
2. Environment
3. Task variables
4. `Taskvars.yml` variables
1. Variables d'appel
2. Variables d'environnement
3. Variables Task
4. Variables `Taskvars.yml`
<!-- prettier-ignore-start -->

View File

@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ Companies who donate at least $50/month will be featured as a "Gold Sponsor" in
## GitHub Sponsors
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use the following links to do your donation:
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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -17,7 +17,7 @@ macOSやLinuxを使っていて、[Homebrew][homebrew]をインストールし
brew install go-task/tap/go-task
```
The above Formula is [maintained by ourselves](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb).
上記のFormulaは、[私たちによってメンテナンスされています](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)
最近、Taskは[公式のHomebrewリポジトリ](https://formulae.brew.sh/formula/go-task)でも利用可能になったので、以下の方法でもインストールできます:

View File

@@ -30,23 +30,13 @@ tasks:
上記の例は始まりに過ぎません。 全てのスキーマやTaskの機能については、[usage](/usage)ガイドを確認するといいでしょう。
## 機能紹介
## 特徴
- [簡単なインストール方法](installation.md): シングルバイナリをダウンロードして、`$PATH`に追加するだけで完了です! または[Homebrew][homebrew]、[Snapcraft][snapcraft]、[Scoop][scoop]を使ってインストールすることができます。
- Clで使用可能: [シンプルなコマンド](installation.md#install-script)でCIスクリプトに追加することでCIパイプラインでTaskを使うことができます。
- 真のクロスプラットフォーム: ほとんどのビルドツールはLinuxまたはmacOSだけで使用可能ですが、Taskは[Goのシェルインタープリタ][sh]を使うことでWindowsもサポートしています。
- コード生成に適している: 特定のファイル群が最後に実行されてから変更されていない場合(タイムスタンプや内容に基づき)、簡単に[タスクの実行を防ぐ](/usage#prevent-unnecessary-work)ことができます。
## ゴールドスポンサー
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -3,7 +3,7 @@ slug: /taskfile-versions/
sidebar_position: 5
---
# Taskfile Versions
# Taskfileバージョン
The Taskfile syntax and features changed with time. This document explains what changed on each version and how to upgrade your Taskfile.

View File

@@ -295,7 +295,7 @@ includes:
### ネームスペースのエイリアス
When including a Taskfile, you can give the namespace a list of `aliases`. This works in the same way as [task aliases](#task-aliases) and can be used together to create shorter and easier-to-type commands.
Taskfileをインクルードする際は、ネームスペースに`エイリアス`のリストを渡すことができます。 これは[タスクエイリアス](#task-aliases)と同じように機能し、短くてタイプしやすいコマンドを使用するために一緒に使うことができます。
```yaml
version: '3'
@@ -308,13 +308,13 @@ 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"}}'`.
インクルードされたTaskfileで宣言された変数は、インクルードしているTaskfile内の変数よりも優先されます インクルードされたTaskfileの変数を上書き可能にしたい場合は、[default関数](https://go-task.github.io/slim-sprig/defaults.html)を使用してください: `MY_VAR: '{{.MY_VAR | default "my-default-value"}}'`
:::
## インターナルタスク
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.
内部タスクはユーザーが直接呼び出すことができないタスクです。 `task --list|--list-all`を実行したときの出力に表示されません。 他のタスクは通常通り内部タスクを呼び出すことができます。 これはコマンドライン上で明確な用途を持たないが、再利用可能で関数のようなタスクを作成するのに便利です。
```yaml
version: '3'
@@ -334,7 +334,7 @@ tasks:
## タスクディレクトリ
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 `dir`:
デフォルトでは、タスクはTaskfileが配置されているディレクトリで実行されます。 ですが、`dir:`を指定することでタスクを簡単に別のディレクトリで実行させることができます。
```yaml
version: '3'
@@ -347,13 +347,13 @@ tasks:
- caddy
```
If the directory does not exist, `task` creates it.
ディレクトリが存在しない場合、`task`が作成します。
## タスクの依存関係
> 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 [Calling Another Task](#calling-another-task) section below.
> 依存関係は並列して実行されるため、実行されるタスクの依存関係が互いに依存しないようにする必要があります。 もしタスクを逐次実行するようにしたい場合は、下記の[別のタスクを呼び出す](#calling-another-task)セクションを参照してください。
You may have tasks that depend on others. Just pointing them on `deps` will make them run automatically before running the parent task:
他のタスクに依存するタスクがあるかもしれません。 `deps`にそれらを指定することで、親タスクを実行する前に自動で実行されるようになります。
```yaml
version: '3'
@@ -369,9 +369,9 @@ tasks:
- esbuild --bundle --minify css/index.css > public/bundle.css
```
In the above example, `assets` will always run right before `build` if you run `task build`.
上記の例では、`task build`を実行すると、`assets`は常に`build`前に実行されます。
A task can have only dependencies and no commands to group tasks together:
タスクは、自身のコマンドを持たずに、グループ化するためだけの依存関係のみを持たせることができます。
```yaml
version: '3'
@@ -389,15 +389,15 @@ tasks:
- esbuild --bundle --minify css/index.css > public/bundle.css
```
If there is more than one dependency, they always run in parallel for better performance.
依存関係が複数ある場合、常に並列で実行されることでパフォーマンスが向上します。
:::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`.
コマンドラインで`--parallel`フラグ(エイリアス `-p`)を使用して、指定されたタスクを並列して実行することができます。 例: `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):
依存関係に情報を渡したい場合は、[別のタスクを呼び出す](#calling-another-task)のと同じ方法で行うことができます。
```yaml
version: '3'
@@ -418,13 +418,13 @@ tasks:
- echo {{.TEXT}}
```
## Platform specific tasks and commands
## プラットフォーム固有のタスクとコマンド
If you want to restrict the running of tasks to explicit platforms, this can be achieved using the `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.
タスクの実行を明示的なプラットフォームに制限したい場合は、`platforms:`キーを使用することができます。 タスクは特定のOS、アーキテクチャ、またはその両方の組み合わせに制限させることができます。 一致しない場合、タスクまたはコマンドはスキップされ、エラーは発生しません。
The values allowed as OS or Arch are valid `GOOS` and `GOARCH` values, as defined by the Go language [here](https://github.com/golang/go/blob/master/src/go/build/syslist.go).
OSまたはArchとして許可されている値は[ここ](https://github.com/golang/go/blob/master/src/go/build/syslist.go)でGo言語によって定義されている有効な`GOOS`と`GOARCH`の値らです。
The `build-windows` task below will run only on Windows, and on any architecture:
以下の`build-windows`タスクはWindowsと任意のアーキテクチャで実行されます:
```yaml
version: '3'
@@ -436,7 +436,7 @@ tasks:
- echo 'Running command on Windows'
```
This can be restricted to a specific architecture as follows:
以下のように特定のアーキテクチャに制限することもできます:
```yaml
version: '3'
@@ -448,7 +448,7 @@ tasks:
- echo 'Running command on Windows (amd64)'
```
It is also possible to restrict the task to specific architectures:
また、特定のアーキテクチャのみに制限することも可能です:
```yaml
version: '3'
@@ -460,7 +460,7 @@ tasks:
- echo 'Running command on amd64'
```
Multiple platforms can be specified as follows:
複数のプラットフォームは以下のように指定できます:
```yaml
version: '3'
@@ -472,7 +472,7 @@ tasks:
- echo 'Running command on Windows (amd64) and macOS'
```
Individual commands can also be restricted to specific platforms:
それぞれのコマンドも特定のプラットフォームに制限することが可能です:
```yaml
version: '3'
@@ -485,7 +485,7 @@ tasks:
- cmd: echo 'Running on all platforms'
```
## Calling another task
## 別のタスクを呼び出す
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:
@@ -1130,7 +1130,7 @@ tasks:
## ヘルプ
Running `task --list` (or `task -l`) lists all tasks with a description. The following Taskfile:
`task --list`(または`task -l`)を実行すると、説明付きで全てのタスクが一覧表示されます。 Taskfileの例:
```yaml
version: '3'
@@ -1155,14 +1155,14 @@ tasks:
- esbuild --bundle --minify css/index.css > public/bundle.css
```
would print the following output:
上記のTaskfileの場合、以下のような出力が表示されます:
```bash
* build: Build the go binary.
* test: Run all the go tests.
```
If you want to see all tasks, there's a `--list-all` (alias `-a`) flag as well.
全てのタスクを見たい場合は、`--list-all`(エイリアス `-a`)のフラグを使用してください。
## タスクの概要を表示する
@@ -1383,11 +1383,11 @@ tasks:
## ドライランモード
Dry run mode (`--dry`) compiles and steps through each task, printing the commands that would be run without executing them. This is useful for debugging your Taskfiles.
ドライランモード(`--dry`)は各タスクをコンパイルし、実際にはコマンドの内容は実行せずに、タスク内の各ステップで実行されるコマンドを表示します。 これはTaskfileをデバッグする際に便利です。
## エラーを無視する
You have the option to ignore errors during command execution. Given the following Taskfile:
コマンド実行時のエラーを無視するオプションがあります。 以下のTaskfileを参照してください:
```yaml
version: '3'
@@ -1399,7 +1399,7 @@ tasks:
- echo "Hello World"
```
Task will abort the execution after running `exit 1` because the status code `1` stands for `EXIT_FAILURE`. However, it is possible to continue with execution using `ignore_error`:
Task`exit 1`を実行した後、実行が中止されます。なぜならステータスコード`1``EXIT_FAILURE`を意味するためです。 しかしながら、`ignore_error`を使用することで、実行を継続させることが可能です:
```yaml
version: '3'
@@ -1412,7 +1412,7 @@ tasks:
- echo "Hello World"
```
`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 `deps` or `cmds`!
`ignore_error`はタスク全体に対しても設定することができます。つまり、全てのコマンドに対してエラーが抑制されます。 一方で`deps``cmds`によって呼び出された他のタスクには伝播しないことに注意してください!
## 出力構文
@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ As empresas que doarem pelo menos $50/mês ganharão destaque como "Patrocinador
## GitHub Sponsors
A forma sugerida de doar para os mantenedores é através do GitHub Sponsors. Basta usar os seguintes links para fazer a sua doação:
A forma sugerida de doar para os mantenedores é através do 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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -30,23 +30,13 @@ E invocá-lo ao rodar `task hello` do seu terminal.
O exemplo acima é apenas o começo. Você pode dar uma olhada no [guia de uso](/usage) para conferir a documentação completa do esquema e as funcionalidades do Task.
## Funcionalidades
## Features
- [Instalação fácil](installation.md): apenas baixe um único binário, adicione-o a `$PATH` e pronto! Ou você também pode instalá-lo usando [Homebrew][homebrew], [Snapcraft][snapcraft] ou [Scoop][scoop] se você quiser.
- Disponível em CIs: adicionando [este script simples](installation.md#install-script) para instalá-lo no seu CI você estará pronto para usar o Task como parte do seu pipeline de CI;
- Verdadeiramente multiplataforma: enquanto a maioria das ferramentas de compilação só funcionam bem no Linux ou macOS, o Task também suporta Windows graças [a este interpretador de shell para Go][sh].
- Ótimo para a geração de código: você pode facilmente [impedir que uma tarefa execute](/usage#prevent-unnecessary-work) se um determinado conjunto de arquivos não tiver mudado desde a última execução (baseado na data de modificação ou conteúdo dos arquivos).
## Patrocinadores de Ouro
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ sidebar_position: 16
## GitHub Sponsors
Предпочтительный способ пожертвования для сопровождающих — через GitHub Sponsors. Просто используйте следующие ссылки, чтобы сделать пожертвование:
Предпочтительный способ пожертвования для сопровождающих — через 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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -3,15 +3,15 @@ slug: /faq/
sidebar_position: 15
---
# FAQ
# ЧАВО
This page contains a list of frequently asked questions about Task.
Эта страница содержит список часто задаваемых вопросов о Task.
## Why won't my task update my shell environment?
## Почему task не обновляет мои переменные среды оболочки?
This is a limitation of how shells work. Task runs as a subprocess of your current shell, so it can't change the environment of the shell that started it. This limitation is shared by other task runners and build tools too.
Это ограничение работы оболочек. Task запускается как подпроцесс вашей текущей оболочки, поэтому он не может сменить переменные среды оболочки, которая запустила его. Это ограничение есть и в других task runners и инструментах сборки тоже.
A common way to work around this is to create a task that will generate output that can be parsed by your shell. For example, to set an environment variable on your shell you can write a task like this:
Самый простой способ обойти это - создать задачу, генерирующую вывод, который может быть проанализирован вашей оболочкой. Например, чтобы установить переменные среды в вашей оболочке, вы можете написать task, похожую на:
```yaml
my-shell-env:
@@ -20,11 +20,11 @@ my-shell-env:
- echo "export BAR=bar"
```
Now run `eval $(task my-shell-env)` and the variables `$FOO` and `$BAR` will be available in your shell.
Теперь запустите `eval $(task my-shell-env)`, после этого переменные `$FOO` и `$BAR` будут доступны в вашей оболочке.
## I can't reuse my shell in a task's commands
## Я не могу переиспользовать свою оболочку в командах task's
Task runs each command as a separate shell process, so something you do in one command won't effect any future commands. For example, this won't work:
Task запускает каждую команду в качестве отдельного процесса оболочки, поэтому действия в одной команде не повлияют на другие команды. Например, это не сработает:
```yaml
version: '3'
@@ -37,7 +37,7 @@ tasks:
# outputs ""
```
To work around this you can either use a multiline command:
Чтобы обойти это, вы можете использовать многострочную команду:
```yaml
version: '3'
@@ -51,7 +51,7 @@ tasks:
# outputs "foo"
```
Or for more complex multi-line commands it is recommended to move your code into a separate file and call that instead:
Или для более сложных многострочных команд рекомендуется перенести ваш код в отдельный файл, и вызвать его вместо команды:
```yaml
version: '3'

View File

@@ -30,23 +30,13 @@ tasks:
Приведенный выше пример - это только начало, вы можете посмотреть на [руководство](/usage) по использованию, чтобы посмотреть полную документацию схемы и функций Task.
## Особенности
## Features
- [Простая установка](installation.md): просто загрузите единственный исполняемый файл, добавьте его в `$PATH` и вы готовы! Или вы можете установить с помощью [Homebrew][homebrew], [Snapcraft][snapcraft] или [Scoop][scoop], если хотите.
- Доступен на CI-серверах: просто добавьте [эту простую команду](installation.md#install-script) для установки в CI-скрипт и готово! Теперь можно использовать Task в качестве части вашего CI-пайплайна.
- Полностью кроссплатформенный: в то время как большинство инструментов сборки хорошо работают только в Linux или macOS, Task также поддерживает Windows, благодаря [интерпретатору командной оболочки для Go][sh].
- Отлично подходит для кодогенерации: вы можете легко [предотвратить запуск задачи](/usage#prevent-unnecessary-work), если необходимый набор файлов не изменился с прошлого запуска (основываясь на времени изменения или содержимом).
## Золотые спонсоры
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -418,13 +418,13 @@ tasks:
- echo {{.TEXT}}
```
## Platform specific tasks and commands
## Платформно-зависимые tasks и команды
If you want to restrict the running of tasks to explicit platforms, this can be achieved using the `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.
Если вы хотите ограничить запуск tasks определенными платформами, вы можете сделать это используя ключ `platforms:`. Tasks могут быть ограничены определенной ОС, архитектурой или комбинацией этих элементов. В случае несоответствия, task или команда будут пропущены, и ошибка не вернется.
The values allowed as OS or Arch are valid `GOOS` and `GOARCH` values, as defined by the Go language [here](https://github.com/golang/go/blob/master/src/go/build/syslist.go).
Разрешенные значения ОС и архитектур или `GOOS` и `GOARCH` определены языком Go [здесь](https://github.com/golang/go/blob/master/src/go/build/syslist.go).
The `build-windows` task below will run only on Windows, and on any architecture:
Task ниже `build-windows` будет выполняться только на Windows любой архитектуры:
```yaml
version: '3'
@@ -436,7 +436,7 @@ tasks:
- echo 'Running command on Windows'
```
This can be restricted to a specific architecture as follows:
Это можно ограничить определенной архитектурой следующим образом:
```yaml
version: '3'
@@ -448,7 +448,7 @@ tasks:
- echo 'Running command on Windows (amd64)'
```
It is also possible to restrict the task to specific architectures:
Также можно ограничить task определенными архитектурами:
```yaml
version: '3'
@@ -460,7 +460,7 @@ tasks:
- echo 'Running command on amd64'
```
Multiple platforms can be specified as follows:
Несколько платформ можно указать так:
```yaml
version: '3'
@@ -472,7 +472,7 @@ tasks:
- echo 'Running command on Windows (amd64) and macOS'
```
Individual commands can also be restricted to specific platforms:
Отдельные команды также могут быть ограничены определенными платформами:
```yaml
version: '3'
@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# Changelog
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ Companies who donate at least $50/month will be featured as a "Gold Sponsor" in
## GitHub Sponsorları
The preferred way to donate to the maintainers is via GitHub Sponsors. Just use the following links to do your donation:
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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -37,16 +37,6 @@ The above example is just the start, you can take a look at the [usage](/usage)
- 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
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -1581,6 +1581,29 @@ With the flags `--watch` or `-w` task will watch for file changes and run the ta
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`.
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -5,6 +5,17 @@ sidebar_position: 14
# 更新日志
## v3.31.0 - 2023-10-07
- Enabled the `--yes` flag for the [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) ([#1344](https://github.com/go-task/task/issues/1344) by [@pd93](https://github.com/pd93)).
- Add ability to set `watch: true` in a task to automatically run it in watch mode ([#231](https://github.com/go-task/task/issues/231), [#1361](https://github.com/go-task/task/issues/1361) by [@andreynering](https://github.com/andreynering)).
- Fixed a bug on the watch mode where paths that contained `.git` (like `.github`), for example, were also being ignored ([#1356](https://github.com/go-task/task/issues/1356) by [@butuzov](https://github.com/butuzov)).
- Fixed a nil pointer error when running a Taskfile with no contents ([#1341](https://github.com/go-task/task/issues/1341), [#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Added a new [exit code](https://taskfile.dev/api/#exit-codes) (107) for when a Taskfile does not contain a schema version ([#1342](https://github.com/go-task/task/issues/1342) by [@pd93](https://github.com/pd93)).
- Increased limit of maximum task calls from 100 to 1000 for now, as some people have been reaching this limit organically now that we have loops. This check exists to detect recursive calls, but will be removed in favor of a better algorithm soon ([#1321](https://github.com/go-task/task/issues/1321), [#1332](https://github.com/go-task/task/issues/1332)).
- Fixed templating on descriptions on `task --list` ([#1343](https://github.com/go-task/task/issues/1343) by [@blackjid](https://github.com/blackjid)).
- Fixed a bug where precondition errors were incorrectly being printed when task execution was aborted ([#1337](https://github.com/go-task/task/issues/1337), [#1338](https://github.com/go-task/task/issues/1338) by [@sylv](https://github.com/sylv)-io).
## v3.30.1 - 2023-09-14
- Fixed a regression where some special variables weren't being set correctly ([#1331](https://github.com/go-task/task/issues/1331), [#1334](https://github.com/go-task/task/issues/1334) by [@pd93](https://github.com/pd93)).

View File

@@ -13,7 +13,7 @@ sidebar_position: 16
## GitHub Sponsors
捐赠给维护者的首选方式是通过 GitHub Sponsors。 只需使用以下链接就可以进行捐赠:
捐赠给维护者的首选方式是通过 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)

View File

@@ -37,15 +37,18 @@ Running commands from sources that you do not control is always a potential secu
1. When running a task from a remote Taskfile for the first time, Task will print a warning to the console asking you to check that you are sure that you trust the source of the Taskfile. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the remote Taskfile will run and further calls to the remote Taskfile will not prompt you again.
2. Whenever you run a remote Taskfile, Task will create and store a checksum of the file that you are running. If the checksum changes, then Task will print another warning to the console to inform you that the contents of the remote file has changed. If you do not accept the prompt, then Task will exit with code `104` (not trusted) and nothing will run. If you accept the prompt, the checksum will be updated and the remote Taskfile will run.
Sometimes you need to run Task in an environment that does not have an interactive terminal, so you are not able to accept a prompt. In these cases you are able to tell task to accept these prompts automatically by using the `--yes` flag. Before enabling this flag, you should:
1. Be sure that you trust the source and contents of the remote Taskfile.
2. Consider using a pinned version of the remote Taskfile (e.g. A link containing a commit hash) to prevent Task from automatically accepting a prompt that says a remote Taskfile has changed.
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.
## Caching & Running Offline
If for whatever reason, you don't have access to the internet, but you still need to be able to run your tasks, you are able to use the `--download` flag to store a cached copy of the remote Taskfile.
Whenever you run a remote Taskfile, the latest copy will be downloaded from the internet and cached locally. If for whatever reason, you lose access to the internet, you will still be able to run your tasks by specifying the `--offline` flag. This will tell Task to use the latest cached version of the file instead of trying to download it. You are able to use the `--download` flag to update the cached version of the remote files without running any tasks.
<!-- TODO: The following behavior may change -->
If Task detects that you have a local copy of the remote Taskfile, it will use your local copy instead of downloading the remote file. You can force Task to work offline by using the `--offline` flag. This will prevent Task from making any calls to remote sources.
By default, Task will timeout requests to download remote files after 10 seconds 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 -->

View File

@@ -30,23 +30,13 @@ tasks:
上面的示例只是一个开始,您可以查看 [使用指南](/usage) 以检查完整的规则文档和 Task 功能。
## 特性
## Features
- [易于安装](installation.md):只需要下载一个二进制文件,添加到 `$PATH` 即可! 或者,您也可以根据需要使用 [Homebrew](https://brew.sh/)、[Snapcraft](https://snapcraft.io/) 或 [Scoop](https://scoop.sh/) 进行安装。
- 可以在 CI 中使用:只要添加 [这个命令](installation.md#安装脚本) 到 CI 安装脚本中,然后就可以把 Task 当做 CI 的一个功能来使用了。
- 真正的跨平台:虽然大多数构建工具只能在 Linux 或 macOS 上运行良好,但由于 [这个用于 Go 的 shell 解释器](https://github.com/mvdan/sh)Task 也支持 Windows。
- 非常适合代码生成:如果给定的一组文件自上次运行以来没有更改(基于其时间戳或内容),您可以轻松地 [阻止 task 运行](/usage#减少不必要的工作)。
## 金牌赞助商
<div class="gold-sponsors">
| [Appwrite](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
| ---------------------------------------------------------------------------------------------------------------------------- |
| [![Appwrite](/img/appwrite.svg)](https://appwrite.io/?utm_source=taskfile.dev&utm_medium=website&utm_campaign=task_oss_fund) |
</div>
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -1581,6 +1581,29 @@ tasks:
默认监控的时间间隔是 5 秒,但可以通过 Taskfile 中根属性 `interval: '500ms'` 设置,也可以通过命令行 参数 `--interval=500ms` 设置。
Also, it's possible to set `watch: true` in a given task and it'll automatically run in watch mode:
```yaml
version: '3'
interval: 500ms
tasks:
build:
desc: Builds the Go application
watch: true
sources:
- '**/*.go'
cmds:
- go build # ...
```
:::info
Note that when setting `watch: true` to a task, it'll only run in watch mode when running from the CLI via `task my-watch-task`, but won't run in watch mode if called by another task, either directly or as a dependency.
:::
<!-- prettier-ignore-start -->
<!-- prettier-ignore-end -->

View File

@@ -88,14 +88,14 @@
"description": "A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs.",
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/3/glob"
}
},
"generates": {
"description": "A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs.",
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/3/glob"
}
},
"status": {
@@ -370,6 +370,10 @@
"description": "Command to run",
"type": "string"
},
"silent": {
"description": "Silent mode disables echoing of command before Task runs it",
"type": "boolean"
},
"task": {
"description": "Task to run",
"type": "string"
@@ -442,6 +446,25 @@
}
}
},
"glob": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/3/glob_obj"
}
]
},
"glob_obj": {
"type": "object",
"properties": {
"exclude": {
"description": "File or glob patter to exclude from the list",
"type": "string"
}
}
},
"run": {
"type": "string",
"enum": ["always", "once", "when_changed"]

View File

@@ -256,6 +256,14 @@
dependencies:
"@babel/highlight" "^7.18.6"
"@babel/code-frame@^7.22.13":
version "7.22.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e"
integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==
dependencies:
"@babel/highlight" "^7.22.13"
chalk "^2.4.2"
"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.17.10":
version "7.17.10"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.10.tgz#711dc726a492dfc8be8220028b1b92482362baab"
@@ -348,6 +356,16 @@
"@jridgewell/gen-mapping" "^0.3.2"
jsesc "^2.5.1"
"@babel/generator@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420"
integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==
dependencies:
"@babel/types" "^7.23.0"
"@jridgewell/gen-mapping" "^0.3.2"
"@jridgewell/trace-mapping" "^0.3.17"
jsesc "^2.5.1"
"@babel/helper-annotate-as-pure@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862"
@@ -476,6 +494,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be"
integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==
"@babel/helper-environment-visitor@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167"
integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==
"@babel/helper-explode-assignable-expression@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a"
@@ -506,6 +529,14 @@
"@babel/template" "^7.18.10"
"@babel/types" "^7.19.0"
"@babel/helper-function-name@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759"
integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==
dependencies:
"@babel/template" "^7.22.15"
"@babel/types" "^7.23.0"
"@babel/helper-hoist-variables@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246"
@@ -520,6 +551,13 @@
dependencies:
"@babel/types" "^7.18.6"
"@babel/helper-hoist-variables@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb"
integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==
dependencies:
"@babel/types" "^7.22.5"
"@babel/helper-member-expression-to-functions@^7.17.7":
version "7.17.7"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz#a34013b57d8542a8c4ff8ba3f747c02452a4d8c4"
@@ -688,11 +726,23 @@
dependencies:
"@babel/types" "^7.18.6"
"@babel/helper-split-export-declaration@^7.22.6":
version "7.22.6"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c"
integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==
dependencies:
"@babel/types" "^7.22.5"
"@babel/helper-string-parser@^7.19.4":
version "7.19.4"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
"@babel/helper-string-parser@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==
"@babel/helper-validator-identifier@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad"
@@ -703,6 +753,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
"@babel/helper-validator-identifier@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
"@babel/helper-validator-option@^7.16.7":
version "7.16.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23"
@@ -769,6 +824,15 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/highlight@^7.22.13":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54"
integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==
dependencies:
"@babel/helper-validator-identifier" "^7.22.20"
chalk "^2.4.2"
js-tokens "^4.0.0"
"@babel/parser@^7.12.7", "@babel/parser@^7.16.7", "@babel/parser@^7.18.0":
version "7.18.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.3.tgz#39e99c7b0c4c56cef4d1eed8de9f506411c2ebc2"
@@ -779,6 +843,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8"
integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==
"@babel/parser@^7.22.15", "@babel/parser@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719"
integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.17.12":
version "7.17.12"
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.17.12.tgz#1dca338caaefca368639c9ffb095afbd4d420b1e"
@@ -2084,35 +2153,28 @@
"@babel/parser" "^7.18.10"
"@babel/types" "^7.18.10"
"@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.18.0", "@babel/traverse@^7.18.2":
version "7.18.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.2.tgz#b77a52604b5cc836a9e1e08dca01cba67a12d2e8"
integrity sha512-9eNwoeovJ6KH9zcCNnENY7DMFwTU9JdGCFtqNLfUAqtUHRCOsTOqWoffosP8vKmNYeSBUv3yVJXjfd8ucwOjUA==
"@babel/template@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38"
integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==
dependencies:
"@babel/code-frame" "^7.16.7"
"@babel/generator" "^7.18.2"
"@babel/helper-environment-visitor" "^7.18.2"
"@babel/helper-function-name" "^7.17.9"
"@babel/helper-hoist-variables" "^7.16.7"
"@babel/helper-split-export-declaration" "^7.16.7"
"@babel/parser" "^7.18.0"
"@babel/types" "^7.18.2"
debug "^4.1.0"
globals "^11.1.0"
"@babel/code-frame" "^7.22.13"
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"
"@babel/traverse@^7.18.8", "@babel/traverse@^7.19.1", "@babel/traverse@^7.20.1", "@babel/traverse@^7.20.5":
version "7.20.5"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.5.tgz#78eb244bea8270fdda1ef9af22a5d5e5b7e57133"
integrity sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==
"@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.18.0", "@babel/traverse@^7.18.2", "@babel/traverse@^7.18.8", "@babel/traverse@^7.19.1", "@babel/traverse@^7.20.1", "@babel/traverse@^7.20.5":
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.18.6"
"@babel/generator" "^7.20.5"
"@babel/helper-environment-visitor" "^7.18.9"
"@babel/helper-function-name" "^7.19.0"
"@babel/helper-hoist-variables" "^7.18.6"
"@babel/helper-split-export-declaration" "^7.18.6"
"@babel/parser" "^7.20.5"
"@babel/types" "^7.20.5"
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
"@babel/parser" "^7.23.0"
"@babel/types" "^7.23.0"
debug "^4.1.0"
globals "^11.1.0"
@@ -2133,6 +2195,15 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb"
integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==
dependencies:
"@babel/helper-string-parser" "^7.22.5"
"@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0"
"@colors/colors@1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
@@ -2634,6 +2705,11 @@
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
"@jridgewell/resolve-uri@^3.1.0":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
"@jridgewell/set-array@^1.0.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea"
@@ -2657,6 +2733,11 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
"@jridgewell/sourcemap-codec@^1.4.14":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
"@jridgewell/trace-mapping@^0.3.14":
version "0.3.17"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985"
@@ -2665,6 +2746,14 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"
"@jridgewell/trace-mapping@^0.3.17":
version "0.3.20"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f"
integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==
dependencies:
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"
"@jridgewell/trace-mapping@^0.3.9":
version "0.3.14"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed"
@@ -3840,7 +3929,7 @@ ccount@^1.0.0:
resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043"
integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==
chalk@^2.0.0:
chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==

View File

@@ -18,6 +18,7 @@ const (
CodeTaskfileNotSecure
CodeTaskfileCacheNotFound
CodeTaskfileVersionNotDefined
CodeTaskfileNetworkTimeout
)
// Task related exit codes

View File

@@ -3,6 +3,7 @@ package errors
import (
"fmt"
"net/http"
"time"
)
// TaskfileNotFoundError is returned when no appropriate Taskfile is found when
@@ -137,3 +138,26 @@ func (err *TaskfileVersionNotDefined) Error() string {
func (err *TaskfileVersionNotDefined) Code() int {
return CodeTaskfileVersionNotDefined
}
// TaskfileNetworkTimeout is returned when the user attempts to use a remote
// Taskfile but a network connection could not be established within the timeout.
type TaskfileNetworkTimeout struct {
URI string
Timeout time.Duration
CheckedCache bool
}
func (err *TaskfileNetworkTimeout) Error() string {
var cacheText string
if err.CheckedCache {
cacheText = " and no offline copy was found in the cache"
}
return fmt.Sprintf(
`task: Network connection timed out after %s while attempting to download Taskfile %q%s`,
err.Timeout, err.URI, cacheText,
)
}
func (err *TaskfileNetworkTimeout) Code() int {
return CodeTaskfileNetworkTimeout
}

10
go.mod
View File

@@ -4,7 +4,7 @@ go 1.20
require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/fatih/color v1.15.0
github.com/fatih/color v1.16.0
github.com/go-task/slim-sprig/v3 v3.0.0
github.com/joho/godotenv v1.5.1
github.com/mattn/go-zglob v0.0.4
@@ -15,8 +15,8 @@ require (
github.com/stretchr/testify v1.8.4
github.com/zeebo/xxh3 v1.0.2
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6
golang.org/x/sync v0.4.0
golang.org/x/term v0.13.0
golang.org/x/sync v0.5.0
golang.org/x/term v0.14.0
gopkg.in/yaml.v3 v3.0.1
mvdan.cc/sh/v3 v3.7.0
)
@@ -25,9 +25,9 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)

21
go.sum
View File

@@ -4,8 +4,8 @@ github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
@@ -19,8 +19,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-zglob v0.0.4 h1:LQi2iOm0/fGgu80AioIJ/1j9w9Oh+9DZ39J4VAGzHQM=
github.com/mattn/go-zglob v0.0.4/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY=
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
@@ -47,13 +47,14 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6 h1:Ic9KukPQ7PegFzHckNiMTQXGgEszA7mY2Fn4ZMtnMbw=
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

41
help.go
View File

@@ -24,14 +24,16 @@ type ListOptions struct {
ListOnlyTasksWithDescriptions bool
ListAllTasks bool
FormatTaskListAsJSON bool
NoStatus bool
}
// NewListOptions creates a new ListOptions instance
func NewListOptions(list, listAll, listAsJson bool) ListOptions {
func NewListOptions(list, listAll, listAsJson, noStatus bool) ListOptions {
return ListOptions{
ListOnlyTasksWithDescriptions: list,
ListAllTasks: listAll,
FormatTaskListAsJSON: listAsJson,
NoStatus: noStatus,
}
}
@@ -48,6 +50,9 @@ func (o ListOptions) Validate() error {
if o.FormatTaskListAsJSON && !o.ShouldListTasks() {
return fmt.Errorf("task: --json only applies to --list or --list-all")
}
if o.NoStatus && !o.FormatTaskListAsJSON {
return fmt.Errorf("task: --no-status only applies to --json with --list or --list-all")
}
return nil
}
@@ -73,7 +78,7 @@ func (e *Executor) ListTasks(o ListOptions) (bool, error) {
return false, err
}
if o.FormatTaskListAsJSON {
output, err := e.ToEditorOutput(tasks)
output, err := e.ToEditorOutput(tasks, o.NoStatus)
if err != nil {
return false, err
}
@@ -154,7 +159,7 @@ func (e *Executor) ListTaskNames(allTasks bool) {
}
}
func (e *Executor) ToEditorOutput(tasks []*taskfile.Task) (*editors.Taskfile, error) {
func (e *Executor) ToEditorOutput(tasks []*taskfile.Task, noStatus bool) (*editors.Taskfile, error) {
o := &editors.Taskfile{
Tasks: make([]editors.Task, len(tasks)),
Location: e.Taskfile.Location,
@@ -164,6 +169,22 @@ func (e *Executor) ToEditorOutput(tasks []*taskfile.Task) (*editors.Taskfile, er
task := tasks[i]
j := i
g.Go(func() error {
o.Tasks[j] = editors.Task{
Name: task.Name(),
Desc: task.Desc,
Summary: task.Summary,
UpToDate: false,
Location: &editors.Location{
Line: task.Location.Line,
Column: task.Location.Column,
Taskfile: task.Location.Taskfile,
},
}
if noStatus {
return nil
}
// Get the fingerprinting method to use
method := e.Taskfile.Method
if task.Method != "" {
@@ -178,17 +199,9 @@ func (e *Executor) ToEditorOutput(tasks []*taskfile.Task) (*editors.Taskfile, er
if err != nil {
return err
}
o.Tasks[j] = editors.Task{
Name: task.Name(),
Desc: task.Desc,
Summary: task.Summary,
UpToDate: upToDate,
Location: &editors.Location{
Line: task.Location.Line,
Column: task.Location.Column,
Taskfile: task.Location.Taskfile,
},
}
o.Tasks[j].UpToDate = upToDate
return nil
})
}

View File

@@ -8,16 +8,25 @@ import (
"github.com/go-task/task/v3/internal/execext"
"github.com/go-task/task/v3/internal/filepathext"
"github.com/go-task/task/v3/taskfile"
)
func Globs(dir string, globs []string) ([]string, error) {
files := make([]string, 0)
func Globs(dir string, globs []*taskfile.Glob) ([]string, error) {
fileMap := make(map[string]bool)
for _, g := range globs {
f, err := Glob(dir, g)
matches, err := Glob(dir, g.Glob)
if err != nil {
continue
}
files = append(files, f...)
for _, match := range matches {
fileMap[match] = !g.Negate
}
}
files := make([]string, 0)
for file, includePath := range fileMap {
if includePath {
files = append(files, file)
}
}
sort.Strings(files)
return files, nil

View File

@@ -53,7 +53,10 @@ func (checker *ChecksumChecker) IsUpToDate(t *taskfile.Task) (bool, error) {
if len(t.Generates) > 0 {
// For each specified 'generates' field, check whether the files actually exist
for _, g := range t.Generates {
generates, err := Glob(t.Dir, g)
if g.Negate {
continue
}
generates, err := Glob(t.Dir, g.Glob)
if os.IsNotExist(err) {
return false, nil
}

View File

@@ -47,7 +47,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect TRUE when no status is defined and sources are up-to-date",
task: &taskfile.Task{
Status: nil,
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: nil,
setupMockSourcesChecker: func(m *mocks.SourcesCheckable) {
@@ -59,7 +59,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect FALSE when no status is defined and sources are NOT up-to-date",
task: &taskfile.Task{
Status: nil,
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: nil,
setupMockSourcesChecker: func(m *mocks.SourcesCheckable) {
@@ -83,7 +83,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect TRUE when status and sources are up-to-date",
task: &taskfile.Task{
Status: []string{"status"},
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: func(m *mocks.StatusCheckable) {
m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil)
@@ -97,7 +97,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect FALSE when status is up-to-date, but sources are NOT up-to-date",
task: &taskfile.Task{
Status: []string{"status"},
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: func(m *mocks.StatusCheckable) {
m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil)
@@ -123,7 +123,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect FALSE when status is NOT up-to-date, but sources are up-to-date",
task: &taskfile.Task{
Status: []string{"status"},
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: func(m *mocks.StatusCheckable) {
m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil)
@@ -137,7 +137,7 @@ func TestIsTaskUpToDate(t *testing.T) {
name: "expect FALSE when status and sources are NOT up-to-date",
task: &taskfile.Task{
Status: []string{"status"},
Sources: []string{"sources"},
Sources: []*taskfile.Glob{{Glob: "sources"}},
},
setupMockStatusChecker: func(m *mocks.StatusCheckable) {
m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil)

View File

@@ -32,6 +32,7 @@ var knownOS = map[string]struct{}{
"solaris": {},
"windows": {},
"zos": {},
"__test__": {},
}
var knownArch = map[string]struct{}{

View File

@@ -80,6 +80,21 @@ func (r *Templater) ReplaceSlice(strs []string) []string {
return new
}
func (r *Templater) ReplaceGlobs(globs []*taskfile.Glob) []*taskfile.Glob {
if r.err != nil || len(globs) == 0 {
return nil
}
new := make([]*taskfile.Glob, len(globs))
for i, g := range globs {
new[i] = &taskfile.Glob{
Glob: r.Replace(g.Glob),
Negate: g.Negate,
}
}
return new
}
func (r *Templater) ReplaceVars(vars *taskfile.Vars) *taskfile.Vars {
return r.replaceVars(vars, nil)
}

2
package-lock.json generated
View File

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

View File

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

View File

@@ -91,6 +91,7 @@ func (e *Executor) readTaskfile() error {
e.Insecure,
e.Download,
e.Offline,
e.Timeout,
e.TempDir,
e.Logger,
)

17
task.go
View File

@@ -46,6 +46,7 @@ type Executor struct {
Insecure bool
Download bool
Offline bool
Timeout time.Duration
Watch bool
Verbose bool
Silent bool
@@ -160,7 +161,16 @@ func (e *Executor) splitRegularAndWatchCalls(calls ...taskfile.Call) (regularCal
// RunTask runs a task by its name
func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error {
t, err := e.CompiledTask(call)
t, err := e.FastCompiledTask(call)
if err != nil {
return err
}
if !shouldRunOnCurrentPlatform(t.Platforms) {
e.Logger.VerboseOutf(logger.Yellow, `task: %q not for current platform - ignored\n`, call.Task)
return nil
}
t, err = e.CompiledTask(call)
if err != nil {
return err
}
@@ -185,11 +195,6 @@ func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error {
}
return e.startExecution(ctx, t, func(ctx context.Context) error {
if !shouldRunOnCurrentPlatform(t.Platforms) {
e.Logger.VerboseOutf(logger.Yellow, `task: %q not for current platform - ignored\n`, call.Task)
return nil
}
e.Logger.VerboseErrf(logger.Magenta, "task: %q started\n", call.Task)
if err := e.runDeps(ctx, t); err != nil {
return err

View File

@@ -1891,27 +1891,47 @@ func TestEvaluateSymlinksInPaths(t *testing.T) {
Stderr: &buff,
Silent: false,
}
require.NoError(t, e.Setup())
err := e.Run(context.Background(), taskfile.Call{Task: "default"})
require.NoError(t, err)
assert.NotEqual(t, `task: Task "default" is up to date`, strings.TrimSpace(buff.String()))
buff.Reset()
err = e.Run(context.Background(), taskfile.Call{Task: "test-sym"})
require.NoError(t, err)
assert.NotEqual(t, `task: Task "test-sym" is up to date`, strings.TrimSpace(buff.String()))
buff.Reset()
err = e.Run(context.Background(), taskfile.Call{Task: "default"})
require.NoError(t, err)
assert.NotEqual(t, `task: Task "default" is up to date`, strings.TrimSpace(buff.String()))
buff.Reset()
err = e.Run(context.Background(), taskfile.Call{Task: "default"})
require.NoError(t, err)
assert.Equal(t, `task: Task "default" is up to date`, strings.TrimSpace(buff.String()))
buff.Reset()
err = e.Run(context.Background(), taskfile.Call{Task: "reset"})
require.NoError(t, err)
buff.Reset()
err = os.RemoveAll(dir + "/.task")
tests := []struct {
name string
task string
expected string
}{
{
name: "default (1)",
task: "default",
expected: "task: [default] echo \"some job\"\nsome job",
},
{
name: "test-sym (1)",
task: "test-sym",
expected: "task: [test-sym] echo \"shared file source changed\" > src/shared/b",
},
{
name: "default (2)",
task: "default",
expected: "task: [default] echo \"some job\"\nsome job",
},
{
name: "default (3)",
task: "default",
expected: `task: Task "default" is up to date`,
},
{
name: "reset",
task: "reset",
expected: "task: [reset] echo \"shared file source\" > src/shared/b\ntask: [reset] echo \"file source\" > src/a",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
require.NoError(t, e.Setup())
err := e.Run(context.Background(), taskfile.Call{Task: test.task})
require.NoError(t, err)
assert.Equal(t, test.expected, strings.TrimSpace(buff.String()))
buff.Reset()
})
}
err := os.RemoveAll(dir + "/.task")
require.NoError(t, err)
}

32
taskfile/glob.go Normal file
View File

@@ -0,0 +1,32 @@
package taskfile
import (
"fmt"
"gopkg.in/yaml.v3"
)
type Glob struct {
Glob string
Negate bool
}
func (g *Glob) UnmarshalYAML(node *yaml.Node) error {
switch node.Kind {
case yaml.ScalarNode:
g.Glob = node.Value
return nil
case yaml.MappingNode:
var glob struct {
Exclude string
}
if err := node.Decode(&glob); err != nil {
return err
}
g.Glob = glob.Exclude
g.Negate = true
return nil
default:
return fmt.Errorf("yaml: line %d: cannot unmarshal %s into task", node.Line, node.ShortTag())
}
}

View File

@@ -73,8 +73,8 @@ func Merge(t1, t2 *Taskfile, includedTaskfile *IncludedTaskfile, namespaces ...s
}
func taskNameWithNamespace(taskName string, namespaces ...string) string {
if strings.HasPrefix(taskName, ":") {
return strings.TrimPrefix(taskName, ":")
if strings.HasPrefix(taskName, NamespaceSeparator) {
return strings.TrimPrefix(taskName, NamespaceSeparator)
}
return strings.Join(append(namespaces, taskName), NamespaceSeparator)
}

View File

@@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"runtime"
"time"
"gopkg.in/yaml.v3"
@@ -37,6 +38,7 @@ func readTaskfile(
node Node,
download,
offline bool,
timeout time.Duration,
tempDir string,
l *logger.Logger,
) (*taskfile.Taskfile, error) {
@@ -51,35 +53,44 @@ func readTaskfile(
}
}
// If the file is remote, check if we have a cached copy
// If we're told to download, skip the cache
if node.Remote() && !download {
if b, err = cache.read(node); !errors.Is(err, os.ErrNotExist) && err != nil {
return nil, err
}
if b != nil {
l.VerboseOutf(logger.Magenta, "task: [%s] Fetched cached copy\n", node.Location())
}
}
// If the file is remote, we found nothing in the cache and we're not
// allowed to download it then we can't do anything.
if node.Remote() && b == nil && offline {
if b == nil && offline {
// If the file is remote and we're in offline mode, check if we have a cached copy
if node.Remote() && offline {
if b, err = cache.read(node); errors.Is(err, os.ErrNotExist) {
return nil, &errors.TaskfileCacheNotFound{URI: node.Location()}
}
}
// If we still don't have a copy, get the file in the usual way
if b == nil {
b, err = node.Read(context.Background())
if err != nil {
} else if err != nil {
return nil, err
}
l.VerboseOutf(logger.Magenta, "task: [%s] Fetched cached copy\n", node.Location())
} else {
downloaded := false
ctx, cf := context.WithTimeout(context.Background(), timeout)
defer cf()
// Read the file
b, err = node.Read(ctx)
// If we timed out then we likely have a network issue
if node.Remote() && errors.Is(ctx.Err(), context.DeadlineExceeded) {
// If a download was requested, then we can't use a cached copy
if download {
return nil, &errors.TaskfileNetworkTimeout{URI: node.Location(), Timeout: timeout}
}
// Search for any cached copies
if b, err = cache.read(node); errors.Is(err, os.ErrNotExist) {
return nil, &errors.TaskfileNetworkTimeout{URI: node.Location(), Timeout: timeout, CheckedCache: true}
} else if err != nil {
return nil, err
}
l.VerboseOutf(logger.Magenta, "task: [%s] Network timeout. Fetched cached copy\n", node.Location())
} else if err != nil {
return nil, err
} else {
downloaded = true
}
// If the node was remote, we need to check the checksum
if node.Remote() {
if node.Remote() && downloaded {
l.VerboseOutf(logger.Magenta, "task: [%s] Fetched remote copy\n", node.Location())
// Get the checksums
@@ -102,24 +113,21 @@ func readTaskfile(
}
}
// If the hash has changed (or is new), store it in the cache
// If the hash has changed (or is new)
if checksum != cachedChecksum {
// Store the checksum
if err := cache.writeChecksum(node, checksum); err != nil {
return nil, err
}
// Cache the file
l.VerboseOutf(logger.Magenta, "task: [%s] Caching downloaded file\n", node.Location())
if err = cache.write(node, b); err != nil {
return nil, err
}
}
}
}
// If the file is remote and we need to cache it
if node.Remote() && download {
l.VerboseOutf(logger.Magenta, "task: [%s] Caching downloaded file\n", node.Location())
// Cache the file for later
if err = cache.write(node, b); err != nil {
return nil, err
}
}
var t taskfile.Taskfile
if err := yaml.Unmarshal(b, &t); err != nil {
return nil, &errors.TaskfileInvalidError{URI: filepathext.TryAbsToRel(node.Location()), Err: err}
@@ -137,12 +145,13 @@ func Taskfile(
insecure bool,
download bool,
offline bool,
timeout time.Duration,
tempDir string,
l *logger.Logger,
) (*taskfile.Taskfile, error) {
var _taskfile func(Node) (*taskfile.Taskfile, error)
_taskfile = func(node Node) (*taskfile.Taskfile, error) {
t, err := readTaskfile(node, download, offline, tempDir, l)
t, err := readTaskfile(node, download, offline, timeout, tempDir, l)
if err != nil {
return nil, err
}

View File

@@ -19,8 +19,8 @@ type Task struct {
Summary string
Requires *Requires
Aliases []string
Sources []string
Generates []string
Sources []*Glob
Generates []*Glob
Status []string
Preconditions []*Precondition
Dir string
@@ -83,8 +83,8 @@ func (t *Task) UnmarshalYAML(node *yaml.Node) error {
Prompt string
Summary string
Aliases []string
Sources []string
Generates []string
Sources []*Glob
Generates []*Glob
Status []string
Preconditions []*Precondition
Dir string

View File

@@ -6,7 +6,9 @@ tasks:
- cp ./source.txt ./generated.txt
sources:
- ./**/glob-with-inexistent-file.txt
- ./source.txt
- ./*.txt
- exclude: ./ignore_me.txt
- exclude: ./generated.txt
generates:
- ./generated.txt
method: checksum

1
testdata/checksum/ignore_me.txt vendored Normal file
View File

@@ -0,0 +1 @@
plz ignore me

View File

@@ -2,31 +2,37 @@ version: '3'
tasks:
build-windows:
deps: [failed-var-other-platform]
platforms: [windows]
cmds:
- echo 'Running task on windows'
build-darwin:
deps: [failed-var-other-platform]
platforms: [darwin]
cmds:
- echo 'Running task on darwin'
build-linux:
deps: [failed-var-other-platform]
platforms: [linux]
cmds:
- echo 'Running task on linux'
build-freebsd:
deps: [failed-var-other-platform]
platforms: [freebsd]
cmds:
- echo 'Running task on freebsd'
build-blank-os:
deps: [failed-var-other-platform]
platforms: []
cmds:
- echo 'Running command'
build-multiple:
deps: [failed-var-other-platform]
platforms: []
cmds:
- cmd: echo 'Running command'
@@ -36,16 +42,19 @@ tasks:
platforms: [darwin]
build-amd64:
deps: [failed-var-other-platform]
platforms: [amd64]
cmds:
- echo "Running command on amd64"
build-arm64:
deps: [failed-var-other-platform]
platforms: [arm64]
cmds:
- echo "Running command on arm64"
build-mixed:
deps: [failed-var-other-platform]
cmds:
- cmd: echo 'building on windows/arm64'
platforms: [windows/arm64]
@@ -53,3 +62,10 @@ tasks:
platforms: [linux/amd64]
- cmd: echo 'building on darwin'
platforms: [darwin]
failed-var-other-platform:
platforms: [__test__]
env:
EXAMPLE_VAR: {sh: exit 1}
vars:
EXAMPLE_VAR: {sh: exit 2}

View File

@@ -50,8 +50,8 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
Prompt: r.Replace(origTask.Prompt),
Summary: r.Replace(origTask.Summary),
Aliases: origTask.Aliases,
Sources: r.ReplaceSlice(origTask.Sources),
Generates: r.ReplaceSlice(origTask.Generates),
Sources: r.ReplaceGlobs(origTask.Sources),
Generates: r.ReplaceGlobs(origTask.Generates),
Dir: r.Replace(origTask.Dir),
Set: origTask.Set,
Shopt: origTask.Shopt,

View File

@@ -142,7 +142,12 @@ func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Ca
}
}
for _, s := range task.Sources {
globs, err := fingerprint.Globs(task.Dir, task.Sources)
if err != nil {
return err
}
for _, s := range globs {
files, err := fingerprint.Glob(task.Dir, s)
if err != nil {
return fmt.Errorf("task: %s: %w", s, err)