1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

apply prettier

This commit is contained in:
Valentin Maerten
2025-08-08 12:34:04 +02:00
parent af2060e54d
commit 50d9b78303
30 changed files with 650 additions and 402 deletions

View File

@@ -1,9 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { VPBadge } from 'vitepress/theme' import { VPBadge } from 'vitepress/theme';
</script> </script>
<template> <template>
<VPBadge type="info"> <VPBadge type="info"> <slot />+ </VPBadge>
<slot />+
</VPBadge>
</template> </template>

View File

@@ -1,32 +1,29 @@
:root { :root {
--ifm-color-primary: #43ABA2 ; --ifm-color-primary: #43aba2;
--vp-home-hero-name-color: var(--ifm-color-primary); --vp-home-hero-name-color: var(--ifm-color-primary);
--vp-c-brand-1: var(--ifm-color-primary); --vp-c-brand-1: var(--ifm-color-primary);
--vp-c-brand-2: var(--ifm-color-primary); --vp-c-brand-2: var(--ifm-color-primary);
--vp-c-brand-3: var(--ifm-color-primary); --vp-c-brand-3: var(--ifm-color-primary);
} }
img[src*="shields.io"] { img[src*='shields.io'] {
display: inline; display: inline;
vertical-align: text-bottom; vertical-align: text-bottom;
} }
img[src*="custom-icon-badges.demolab.com"] { img[src*='custom-icon-badges.demolab.com'] {
display: inline; display: inline;
height: 1em; height: 1em;
vertical-align: text-bottom; vertical-align: text-bottom;
}
.github-user-mention {
font-weight: 700 !important;
} }
.github-user-mention {
font-weight: 700 !important;
}
.vp-doc .blog-post:first-of-type { .vp-doc .blog-post:first-of-type {
margin-top: 2rem; margin-top: 2rem;
} }
.blog-post { .blog-post {
animation: fadeInUp 0.6s ease-out; animation: fadeInUp 0.6s ease-out;
} }
@@ -42,6 +39,12 @@ img[src*="custom-icon-badges.demolab.com"] {
} }
} }
.blog-post:nth-of-type(1) { animation-delay: 0.1s; } .blog-post:nth-of-type(1) {
.blog-post:nth-of-type(2) { animation-delay: 0.2s; } animation-delay: 0.1s;
.blog-post:nth-of-type(3) { animation-delay: 0.3s; } }
.blog-post:nth-of-type(2) {
animation-delay: 0.2s;
}
.blog-post:nth-of-type(3) {
animation-delay: 0.3s;
}

View File

@@ -1,4 +1,4 @@
version: "3" version: '3'
tasks: tasks:
install: install:
@@ -51,4 +51,3 @@ tasks:
desc: Build and deploy Website to Netlify desc: Build and deploy Website to Netlify
cmds: cmds:
- pnpm netlify deploy --prod --site=054cd897-66d2-46fa-9b57-4831a8d61b37 - pnpm netlify deploy --prod --site=054cd897-66d2-46fa-9b57-4831a8d61b37

View File

@@ -9,15 +9,23 @@ outline: deep
<AuthorCard :author="$frontmatter.author" /> <AuthorCard :author="$frontmatter.author" />
Task has always had variables, but even though you were able to define them using different YAML types, they would always be converted to strings by Task. This limited users to string manipulation and encouraged messy workarounds for simple problems. Starting from [v3.37.0][v3.37.0], this is no longer the case! Task now supports most variable types, including **booleans**, **integers**, **floats** and **arrays**! Task has always had variables, but even though you were able to define them
using different YAML types, they would always be converted to strings by Task.
This limited users to string manipulation and encouraged messy workarounds for
simple problems. Starting from [v3.37.0][v3.37.0], this is no longer the case!
Task now supports most variable types, including **booleans**, **integers**,
**floats** and **arrays**!
## What's the big deal? ## What's the big deal?
These changes allow you to use variables in a much more natural way and opens up a wide variety of sprig functions that were previously useless. Take a look at some of the examples below for some inspiration. These changes allow you to use variables in a much more natural way and opens up
a wide variety of sprig functions that were previously useless. Take a look at
some of the examples below for some inspiration.
### Evaluating booleans ### Evaluating booleans
No more comparing strings to "true" or "false". Now you can use actual boolean values in your templates: No more comparing strings to "true" or "false". Now you can use actual boolean
values in your templates:
::: code-group ::: code-group
@@ -61,7 +69,9 @@ tasks:
- 'echo {{add .INT .FLOAT}}' - 'echo {{add .INT .FLOAT}}'
``` ```
You can use any of the following arithmetic functions: `add`, `sub`, `mul`, `div`, `mod`, `max`, `min`, `floor`, `ceil`, `round` and `randInt`. Check out the [slim-sprig math documentation][slim-sprig-math] for more information. You can use any of the following arithmetic functions: `add`, `sub`, `mul`,
`div`, `mod`, `max`, `min`, `floor`, `ceil`, `round` and `randInt`. Check out
the [slim-sprig math documentation][slim-sprig-math] for more information.
### Arrays ### Arrays
@@ -78,11 +88,18 @@ tasks:
- 'echo {{range .ARRAY}}{{.}}{{end}}' - 'echo {{range .ARRAY}}{{.}}{{end}}'
``` ```
You can use any of the following list-based functions: `first`, `rest`, `last`, `initial`, `append`, `prepend`, `concat`, `reverse`, `uniq`, `without`, `has`, `compact`, `slice` and `chunk`. Check out the [slim-sprig lists documentation][slim-sprig-list] for more information. You can use any of the following list-based functions: `first`, `rest`, `last`,
`initial`, `append`, `prepend`, `concat`, `reverse`, `uniq`, `without`, `has`,
`compact`, `slice` and `chunk`. Check out the [slim-sprig lists
documentation][slim-sprig-list] for more information.
### Looping over variables using `for` ### Looping over variables using `for`
Previously, you would have to use a delimiter separated string to loop over an arbitrary list of items in a variable and split them by using the `split` subkey to specify the delimiter. However, we have now added support for looping over "collection-type" variables using the `for` keyword, so now you are able to loop over list variables directly: Previously, you would have to use a delimiter separated string to loop over an
arbitrary list of items in a variable and split them by using the `split` subkey
to specify the delimiter. However, we have now added support for looping over
"collection-type" variables using the `for` keyword, so now you are able to loop
over list variables directly:
::: code-group ::: code-group
@@ -117,10 +134,14 @@ tasks:
## What about maps? ## What about maps?
Maps were originally included in the Any Variables experiment. However, they weren't quite ready yet. Instead of making you wait for everything to be ready at once, we have released support for all other variable types and we will continue working on map support in the new "[Map Variables][map-variables]" experiment. Maps were originally included in the Any Variables experiment. However, they
weren't quite ready yet. Instead of making you wait for everything to be ready
at once, we have released support for all other variable types and we will
continue working on map support in the new "[Map Variables][map-variables]"
experiment.
We're looking for feedback on a couple of different proposals, so please give
We're looking for feedback on a couple of different proposals, so please give them a go and let us know what you think. :pray: them a go and let us know what you think. :pray:
[v3.37.0]: https://github.com/go-task/task/releases/tag/v3.37.0 [v3.37.0]: https://github.com/go-task/task/releases/tag/v3.37.0
[slim-sprig-math]: https://go-task.github.io/slim-sprig/math.html [slim-sprig-math]: https://go-task.github.io/slim-sprig/math.html

View File

@@ -20,6 +20,3 @@ author="pd93"
description="A look at where Task is, where it's going and how we're going to get there. Lately, Task has been growing extremely quickly and I've found myself thinking a lot about the future of the project and how we continue to evolve and grow. I'm not much of a writer, but I think one of the things we could do better is to communicate these kinds of thoughts to the community." description="A look at where Task is, where it's going and how we're going to get there. Lately, Task has been growing extremely quickly and I've found myself thinking a lot about the future of the project and how we continue to evolve and grow. I'm not much of a writer, but I think one of the things we could do better is to communicate these kinds of thoughts to the community."
:tags="['roadmap', 'experiments', 'community']" :tags="['roadmap', 'experiments', 'community']"
/> />

View File

@@ -1,6 +1,7 @@
--- ---
title: Introducing Experiments title: Introducing Experiments
description: A look at where task is, where it's going and how we're going to get there. description:
A look at where task is, where it's going and how we're going to get there.
author: pd93 author: pd93
date: 2024-05-09 date: 2024-05-09
outline: deep outline: deep
@@ -10,62 +11,115 @@ outline: deep
<AuthorCard :author="$frontmatter.author" /> <AuthorCard :author="$frontmatter.author" />
Lately, Task has been growing extremely quickly and I've found myself thinking a lot about the future of the project and how we continue to evolve and grow. I'm not much of a writer, but I think one of the things we could do better is to communicate these kinds of thoughts to the community. So, with that in mind, this is the first (hopefully of many) blog posts talking about Task and what we're up to. Lately, Task has been growing extremely quickly and I've found myself thinking a
lot about the future of the project and how we continue to evolve and grow. I'm
not much of a writer, but I think one of the things we could do better is to
communicate these kinds of thoughts to the community. So, with that in mind,
this is the first (hopefully of many) blog posts talking about Task and what
we're up to.
## :calendar: So, what have we been up to? ## :calendar: So, what have we been up to?
Over the past 12 months or so, @andreynering (Author and maintainer of the project) and I (@pd93) have been working in our spare time to maintain and improve v3 of Task and we've made some amazing progress. Here are just some of the things we've released in that time: Over the past 12 months or so, @andreynering (Author and maintainer of the
project) and I (@pd93) have been working in our spare time to maintain and
improve v3 of Task and we've made some amazing progress. Here are just some of
the things we've released in that time:
- An official [extension for VS Code][vscode-task]. - An official [extension for VS Code][vscode-task].
- Internal Tasks (#818). - Internal Tasks (#818).
- Task aliases (#879). - Task aliases (#879).
- Looping over tasks (#1220). - Looping over tasks (#1220).
- A series of refactors to the core codebase to make it more maintainable and extensible. - A series of refactors to the core codebase to make it more maintainable and
extensible.
- Loads of bug fixes and improvements. - Loads of bug fixes and improvements.
- An integration with [Crowdin][crowdin]. Work is in progress on making our docs available in **7 new languages** (Special thanks to all our translators for the huge help with this!). - An integration with [Crowdin][crowdin]. Work is in progress on making our docs
available in **7 new languages** (Special thanks to all our translators for
the huge help with this!).
- And much, much more! :sparkles: - And much, much more! :sparkles:
We're also working on adding some really exciting and highly requested features to Task such as having the ability to run remote Taskfiles (#1317). We're also working on adding some really exciting and highly requested features
to Task such as having the ability to run remote Taskfiles (#1317).
None of this would have been possible without the [150 or so (and growing) contributors][contributors] to the project, numerous sponsors and a passionate community of users. Together we have more than doubled the number of GitHub stars to over 8400 :star: since the beginning of 2022 and this continues to accelerate. We can't thank you all enough for your help and support! 🚀 None of this would have been possible without the [150 or so (and growing)
contributors][contributors] to the project, numerous sponsors and a passionate
community of users. Together we have more than doubled the number of GitHub
stars to over 8400 :star: since the beginning of 2022 and this continues to
accelerate. We can't thank you all enough for your help and support! 🚀
[![Star History Chart](https://api.star-history.com/svg?repos=go-task/task&type=Date)](https://star-history.com/#go-task/task&Date) [![Star History Chart](https://api.star-history.com/svg?repos=go-task/task&type=Date)](https://star-history.com/#go-task/task&Date)
## What's next? :thinking: ## What's next? :thinking:
It's extremely motivating to see so many people using and loving Task. However, in this time we've also seen an increase in the number of issues and feature requests. In particular, issues that require some kind of breaking change to Task. This isn't a bad thing, but as we grow we need to be more responsible about how we address these changes in a way that ensures stability and compatibility for existing users and their Taskfiles. It's extremely motivating to see so many people using and loving Task. However,
in this time we've also seen an increase in the number of issues and feature
requests. In particular, issues that require some kind of breaking change to
Task. This isn't a bad thing, but as we grow we need to be more responsible
about how we address these changes in a way that ensures stability and
compatibility for existing users and their Taskfiles.
At this point you're probably thinking something like: At this point you're probably thinking something like:
> "But you use [semantic versioning][semver] - Just release a new major version with your breaking changes." > "But you use [semantic versioning][semver] - Just release a new major version
> with your breaking changes."
And you'd be right... sort of. In theory, this sounds great, but the reality is that we don't have the time to commit to a major overhaul of Task in one big bang release. This would require a colossal amount of time and coordination and with full time jobs and personal lives to tend to, this is a difficult commitment to make. Smaller, more frequent major releases are also a significant inconvenience for users as they have to constantly keep up-to-date with our breaking changes. Fortunately, there is a better way. And you'd be right... sort of. In theory, this sounds great, but the reality is
that we don't have the time to commit to a major overhaul of Task in one big
bang release. This would require a colossal amount of time and coordination and
with full time jobs and personal lives to tend to, this is a difficult
commitment to make. Smaller, more frequent major releases are also a significant
inconvenience for users as they have to constantly keep up-to-date with our
breaking changes. Fortunately, there is a better way.
## What's going to change? :monocle_face: ## What's going to change? :monocle_face:
Going forwards, breaking changes will be allowed into _minor_ versions of Task as "experimental features". To access these features users will need opt-in by enabling feature flags. This will allow us to release new features slowly and gather feedback from the community before making them the default behavior in a future major release. Going forwards, breaking changes will be allowed into _minor_ versions of Task
as "experimental features". To access these features users will need opt-in by
enabling feature flags. This will allow us to release new features slowly and
gather feedback from the community before making them the default behavior in a
future major release.
To prepare users for the next major release, we will maintain a list of [deprecated features][deprecations] and [experiments][experiments] on our docs website and publish information on how to migrate to the new behavior. To prepare users for the next major release, we will maintain a list of
[deprecated features][deprecations] and [experiments][experiments] on our docs
website and publish information on how to migrate to the new behavior.
You can read the [full breaking change proposal][breaking-change-proposal] and view all the [current experiments and their status][experiments-project] on GitHub including the [Gentle Force][gentle-force-experiment] and [Remote Taskfiles][remote-taskfiles-experiment] experiments. You can read the [full breaking change proposal][breaking-change-proposal] and
view all the [current experiments and their status][experiments-project] on
GitHub including the [Gentle Force][gentle-force-experiment] and [Remote
Taskfiles][remote-taskfiles-experiment] experiments.
## What will happen to v2/v3 features? ## What will happen to v2/v3 features?
v2 has been [officially deprecated][deprecate-version-2-schema]. If you're still using a Taskfile with `version: "2"` at the top we _strongly recommend_ that you upgrade as soon as possible. Removing v2 will allow us to tidy up the codebase and focus on new functionality instead. v2 has been [officially deprecated][deprecate-version-2-schema]. If you're still
using a Taskfile with `version: "2"` at the top we _strongly recommend_ that you
upgrade as soon as possible. Removing v2 will allow us to tidy up the codebase
and focus on new functionality instead.
When v4 is released, we will continue to support v3 for a period of time (bug fixes etc). However, since we are moving from a backward-compatibility model to a forwards-compatibility model, **v4 itself will not be backwards compatible with v3**. When v4 is released, we will continue to support v3 for a period of time (bug
fixes etc). However, since we are moving from a backward-compatibility model to
a forwards-compatibility model, **v4 itself will not be backwards compatible
with v3**.
## v4 When? :eyes: ## v4 When? :eyes:
:man_shrugging: When it's ready. :man_shrugging: When it's ready.
In all seriousness, we don't have a timeline for this yet. We'll be working on the most serious deficiencies of the v3 API first and regularly evaluating the state of the project. When we feel its in a good, stable place and we have a clear upgrade path for users and a number of stable experiments, we'll start to think about v4. In all seriousness, we don't have a timeline for this yet. We'll be working on
the most serious deficiencies of the v3 API first and regularly evaluating the
state of the project. When we feel its in a good, stable place and we have a
clear upgrade path for users and a number of stable experiments, we'll start to
think about v4.
## :wave: Final thoughts ## :wave: Final thoughts
Task is growing fast and we're excited to see where it goes next. We hope that the steps we're taking to improve the project and our process will help us to continue to grow. As always, if you have any questions or feedback, we encourage you to comment on or open [issues][issues] and [discussions][discussions] on GitHub. Alternatively, you can join us on [Discord][discord]. Task is growing fast and we're excited to see where it goes next. We hope that
the steps we're taking to improve the project and our process will help us to
continue to grow. As always, if you have any questions or feedback, we encourage
you to comment on or open [issues][issues] and [discussions][discussions] on
GitHub. Alternatively, you can join us on [Discord][discord].
I plan to write more of these blog posts in the future on a variety of Task-related topics, so make sure to check in occasionally and see what we're up to! I plan to write more of these blog posts in the future on a variety of
Task-related topics, so make sure to check in occasionally and see what we're up
to!
[vscode-task]: https://github.com/go-task/vscode-task [vscode-task]: https://github.com/go-task/vscode-task
[crowdin]: https://crowdin.com [crowdin]: https://crowdin.com

View File

@@ -92,8 +92,8 @@ Reverted the changes made in #2113 and #2186 that affected the
- The default taskfile (output when using the `--init` flag) is now an embedded - The default taskfile (output when using the `--init` flag) is now an embedded
file in the binary instead of being stored in the code (#2112 by @pd93). file in the binary instead of being stored in the code (#2112 by @pd93).
- Improved the way we report the Task version when using the `--version` flag or - Improved the way we report the Task version when using the `--version` flag or
<span v-pre>`{{.TASK_VERSION}}`</span> variable. This should now be more consistent and easier <span v-pre>`{{.TASK_VERSION}}`</span> variable. This should now be more
for package maintainers to use (#2131 by @pd93). consistent and easier for package maintainers to use (#2131 by @pd93).
- Fixed a bug where globstar (`**`) matching in `sources` only resolved the - Fixed a bug where globstar (`**`) matching in `sources` only resolved the
first result (#2073, #2075 by @pd93). first result (#2073, #2075 by @pd93).
- Fixed a bug where sorting tasks by "none" would use the default sorting - Fixed a bug where sorting tasks by "none" would use the default sorting
@@ -553,9 +553,10 @@ stabilize the API in the future. #121 now tracks this piece of work.
- Fix a missing a line break on log when using `--watch` mode (#1285, #1297 by - Fix a missing a line break on log when using `--watch` mode (#1285, #1297 by
@FilipSolich). @FilipSolich).
- Fix `defer` on JSON Schema (#1288 by @calvinmclean and @andreynering). - Fix `defer` on JSON Schema (#1288 by @calvinmclean and @andreynering).
- Fix bug in usage of special variables like <span v-pre>`{{.USER_WORKING_DIR}}`</span> in - Fix bug in usage of special variables like
combination with `includes` (#1046, #1205, #1250, #1293, #1312, #1274 by <span v-pre>`{{.USER_WORKING_DIR}}`</span> in combination with `includes`
@andarto, #1309 by @andreynering). (#1046, #1205, #1250, #1293, #1312, #1274 by @andarto, #1309 by
@andreynering).
- Fix bug on `--status` flag. Running this flag should not have side-effects: it - Fix bug on `--status` flag. Running this flag should not have side-effects: it
should not update the checksum on `.task`, only report its status (#1305, should not update the checksum on `.task`, only report its status (#1305,
#1307 by @visciang, #1313 by @andreynering). #1307 by @visciang, #1313 by @andreynering).
@@ -661,9 +662,10 @@ it a go and let us know what you think via a
- Change the name of the file generated by `task --init` from `Taskfile.yaml` to - Change the name of the file generated by `task --init` from `Taskfile.yaml` to
`Taskfile.yml` (#1062 by @misitebao). `Taskfile.yml` (#1062 by @misitebao).
- Added new `splitArgs` template function - Added new `splitArgs` template function
(<span v-pre>`{{splitArgs "foo bar 'foo bar baz'"}}`</span>) to ensure string is split as (<span v-pre>`{{splitArgs "foo bar 'foo bar baz'"}}`</span>) to ensure string
arguments (#1040, #1059 by @dhanusaputra). is split as arguments (#1040, #1059 by @dhanusaputra).
- Fix the value of <span v-pre>`{{.CHECKSUM}}`</span> variable in status (#1076, #1080 by @pd93). - Fix the value of <span v-pre>`{{.CHECKSUM}}`</span> variable in status (#1076,
#1080 by @pd93).
- Fixed deep copy implementation (#1072 by @pd93) - Fixed deep copy implementation (#1072 by @pd93)
- Created a tool to assist with releases (#1086 by @pd93). - Created a tool to assist with releases (#1086 by @pd93).
@@ -715,8 +717,8 @@ it a go and let us know what you think via a
- Small bug fix: closing `Taskfile.yml` once we're done reading it (#963, #964 - Small bug fix: closing `Taskfile.yml` once we're done reading it (#963, #964
by @HeCorr). by @HeCorr).
- Fixes a bug in v2 that caused a panic when using a <span v-pre>`Taskfile_{{OS}}.yml`</span> file - Fixes a bug in v2 that caused a panic when using a
(#961, #971 by @pd93). <span v-pre>`Taskfile_{{OS}}.yml`</span> file (#961, #971 by @pd93).
- Fixed a bug where watch intervals set in the Taskfile were not being respected - Fixed a bug where watch intervals set in the Taskfile were not being respected
(#969, #970 by @pd93) (#969, #970 by @pd93)
- Add `--json` flag (alias `-j`) with the intent to improve support for code - Add `--json` flag (alias `-j`) with the intent to improve support for code
@@ -734,7 +736,8 @@ it a go and let us know what you think via a
- Add task-level `dotenv` support (#389, #904). - Add task-level `dotenv` support (#389, #904).
- It's now possible to use global level variables on `includes` (#942, #943). - It's now possible to use global level variables on `includes` (#942, #943).
- The website got a brand new - The website got a brand new
[translation to Chinese](https://task-zh.readthedocs.io/zh_CN/latest/) by @DeronW. Thanks! [translation to Chinese](https://task-zh.readthedocs.io/zh_CN/latest/) by
@DeronW. Thanks!
## v3.18.0 - 2022-11-12 ## v3.18.0 - 2022-11-12
@@ -851,11 +854,10 @@ it a go and let us know what you think via a
with the `defer:` keyword with the `defer:` keyword
([Documentation](https://taskfile.dev/#/usage?id=doing-task-cleanup-with-defer), ([Documentation](https://taskfile.dev/#/usage?id=doing-task-cleanup-with-defer),
#475, #626). #475, #626).
- Remove long deprecated and undocumented `--- - Remove long deprecated and undocumented `--- title: Changelog description:
title: Changelog Historique complet des versions et changements de Task, de la v3.44.1 jusqu'à
description: Historique complet des versions et changements de Task, de la v3.44.1 jusqu'à la v1.0.0 la v1.0.0 permalink: /changelog/ outline: deep
permalink: /changelog/
outline: deep
--- ---
# Changelog # Changelog
@@ -947,8 +949,8 @@ Reverted the changes made in #2113 and #2186 that affected the
- The default taskfile (output when using the `--init` flag) is now an embedded - The default taskfile (output when using the `--init` flag) is now an embedded
file in the binary instead of being stored in the code (#2112 by @pd93). file in the binary instead of being stored in the code (#2112 by @pd93).
- Improved the way we report the Task version when using the `--version` flag or - Improved the way we report the Task version when using the `--version` flag or
<span v-pre>`{{.TASK_VERSION}}`</span> variable. This should now be more consistent and easier <span v-pre>`{{.TASK_VERSION}}`</span> variable. This should now be more
for package maintainers to use (#2131 by @pd93). consistent and easier for package maintainers to use (#2131 by @pd93).
- Fixed a bug where globstar (`**`) matching in `sources` only resolved the - Fixed a bug where globstar (`**`) matching in `sources` only resolved the
first result (#2073, #2075 by @pd93). first result (#2073, #2075 by @pd93).
- Fixed a bug where sorting tasks by "none" would use the default sorting - Fixed a bug where sorting tasks by "none" would use the default sorting
@@ -1355,8 +1357,7 @@ stabilize the API in the future. #121 now tracks this piece of work.
- The - The
[Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles) [Remote Taskfiles experiment](https://taskfile.dev/experiments/remote-taskfiles)
now prefers remote files over cached ones by default (#1317, #1345 by @pd93). now prefers remote files over cached ones by default (#1317, #1345 by @pd93).
variable prefix and `^` command variable prefix and `^` command prefix (#642, #644, #645).
prefix (#642, #644, #645).
- Add support for `.yaml` extension (as an alternative to `.yml`). This was - Add support for `.yaml` extension (as an alternative to `.yml`). This was
requested multiple times throughout the years. Enjoy! (#183, #184, #369, #584, requested multiple times throughout the years. Enjoy! (#183, #184, #369, #584,
#621). #621).
@@ -1374,8 +1375,8 @@ stabilize the API in the future. #121 now tracks this piece of work.
- Add logging in verbose mode for when a task starts and finishes (#533, #588). - Add logging in verbose mode for when a task starts and finishes (#533, #588).
- Fix an issue with preconditions and context errors (#597, #598). - Fix an issue with preconditions and context errors (#597, #598).
- Quote each <span v-pre>`{{.CLI_ARGS}}`</span> argument to prevent one with spaces to become many - Quote each <span v-pre>`{{.CLI_ARGS}}`</span> argument to prevent one with
(#613). spaces to become many (#613).
- Fix nil pointer when `cmd:` was left empty (#612, #614). - Fix nil pointer when `cmd:` was left empty (#612, #614).
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains two relevant - Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains two relevant
fixes: fixes:
@@ -1391,8 +1392,8 @@ stabilize the API in the future. #121 now tracks this piece of work.
## v3.9.0 - 2021-10-02 ## v3.9.0 - 2021-10-02
- A new `shellQuote` function was added to the template system - A new `shellQuote` function was added to the template system
(<span v-pre>`{{shellQuote "a string"}}`</span>) to ensure a string is safe for use in shell (<span v-pre>`{{shellQuote "a string"}}`</span>) to ensure a string is safe
([mvdan/sh#727](https://github.com/mvdan/sh/pull/727), for use in shell ([mvdan/sh#727](https://github.com/mvdan/sh/pull/727),
[mvdan/sh#737](https://github.com/mvdan/sh/pull/737), [mvdan/sh#737](https://github.com/mvdan/sh/pull/737),
[Documentation](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote)) [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote))
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with - In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded with

View File

@@ -1,6 +1,8 @@
--- ---
title: Community title: Community
description: Task community contributions, installation methods, and integrations maintained by third parties description:
Task community contributions, installation methods, and integrations
maintained by third parties
outline: deep outline: deep
--- ---

View File

@@ -1,6 +1,8 @@
--- ---
title: Contributing title: Contributing
description: Comprehensive guide for contributing to the Task project, including setup, development, testing, and submitting PRs description:
Comprehensive guide for contributing to the Task project, including setup,
development, testing, and submitting PRs
outline: deep outline: deep
--- ---
@@ -28,9 +30,10 @@ Studio Code][vscode-task].
you invest your time into a PR. you invest your time into a PR.
- **Experiments** - If there is no way to make your change backward compatible - **Experiments** - If there is no way to make your change backward compatible
then there is a procedure to introduce breaking changes into minor versions. then there is a procedure to introduce breaking changes into minor versions.
We call these "[experiments](/experiments/)". If you're intending to work on an We call these "[experiments](/experiments/)". If you're intending to work on
experiment, then please read the [experiments workflow](/experiments/#workflow) an experiment, then please read the
document carefully and submit a proposal first. [experiments workflow](/experiments/#workflow) document carefully and submit a
proposal first.
## 1. Setup ## 1. Setup
@@ -50,10 +53,11 @@ Studio Code][vscode-task].
docs][golangci-lint-docs] for a guide on how to setup your editor to docs][golangci-lint-docs] for a guide on how to setup your editor to
auto-format your code. Any Markdown or TypeScript files should be formatted auto-format your code. Any Markdown or TypeScript files should be formatted
and linted by [Prettier][prettier]. This style is enforced by our CI to ensure and linted by [Prettier][prettier]. This style is enforced by our CI to ensure
that we have a consistent style across the project. You can use the `task that we have a consistent style across the project. You can use the
lint` command to lint the code locally and the `task lint:fix` command to try `task lint` command to lint the code locally and the `task lint:fix` command
to automatically fix any issues that are found. You can also use the `task to try to automatically fix any issues that are found. You can also use the
fmt` command to auto-format the files if your editor doesn't do it for you. `task fmt` command to auto-format the files if your editor doesn't do it for
you.
- **Documentation** - Ensure that you add/update any relevant documentation. See - **Documentation** - Ensure that you add/update any relevant documentation. See
the [updating documentation](#updating-documentation) section below. the [updating documentation](#updating-documentation) section below.
- **Tests** - Ensure that you add/update any relevant tests and that all tests - **Tests** - Ensure that you add/update any relevant tests and that all tests
@@ -82,17 +86,17 @@ by using `task website` (requires `nodejs` & `yarn`). All content is written in
directory. All Markdown documents should have an 80 character line wrap limit directory. All Markdown documents should have an 80 character line wrap limit
(enforced by Prettier). (enforced by Prettier).
When making a change, consider whether a change to the [Usage Guide](/usage.md) is When making a change, consider whether a change to the [Usage Guide](/usage.md)
necessary. This document contains descriptions and examples of how to use Task is necessary. This document contains descriptions and examples of how to use
features. If you're adding a new feature, try to find an appropriate place to Task features. If you're adding a new feature, try to find an appropriate place
add a new section. If you're updating an existing feature, ensure that the to add a new section. If you're updating an existing feature, ensure that the
documentation and any examples are up-to-date. Ensure that any examples follow documentation and any examples are up-to-date. Ensure that any examples follow
the [Taskfile Styleguide](/styleguide.md). the [Taskfile Styleguide](/styleguide.md).
If you added a new command or flag, ensure that you add it to the [CLI If you added a new command or flag, ensure that you add it to the
Reference](/reference/cli.md). New fields also need to be added to the [Schema [CLI Reference](/reference/cli.md). New fields also need to be added to the
Reference](/reference/schema.md) and [JSON Schema][json-schema]. The descriptions [Schema Reference](/reference/schema.md) and [JSON Schema][json-schema]. The
for fields in the docs and the schema should match. descriptions for fields in the docs and the schema should match.
### Writing tests ### Writing tests
@@ -164,10 +168,12 @@ If you have questions, feel free to ask them in the `#help` forum channel on our
[nodejs]: https://nodejs.org/en/ [nodejs]: https://nodejs.org/en/
[yarn]: https://yarnpkg.com/ [yarn]: https://yarnpkg.com/
[docusaurus]: https://docusaurus.io [docusaurus]: https://docusaurus.io
[json-schema]: https://github.com/go-task/task/blob/main/website/static/schema.json [json-schema]:
https://github.com/go-task/task/blob/main/website/static/schema.json
[task-open-issues]: https://github.com/go-task/task/issues [task-open-issues]: https://github.com/go-task/task/issues
[vscode-task-open-issues]: https://github.com/go-task/vscode-task/issues [vscode-task-open-issues]: https://github.com/go-task/vscode-task/issues
[good-first-issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 [good-first-issue]:
https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[discord-server]: https://discord.gg/6TY36E39UK [discord-server]: https://discord.gg/6TY36E39UK
[discussion]: https://github.com/go-task/task/discussions [discussion]: https://github.com/go-task/task/discussions
[conventional-commits]: https://www.conventionalcommits.org [conventional-commits]: https://www.conventionalcommits.org

View File

@@ -9,7 +9,8 @@ outline: deep
::: warning ::: warning
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 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. environment. They are intended for testing and feedback only.
::: :::
@@ -25,8 +26,9 @@ This experiment breaks the following functionality:
::: info ::: info
To enable this experiment, set the environment variable: To enable this experiment, set the environment variable:
`TASK_X_ENV_PRECEDENCE=1`. Check out [our guide to enabling `TASK_X_ENV_PRECEDENCE=1`. Check out
experiments](/experiments/#enabling-experiments) for more information. [our guide to enabling experiments](/experiments/#enabling-experiments) for more
information.
::: :::

View File

@@ -25,7 +25,9 @@ This experiment breaks the following functionality:
::: info ::: info
To enable this experiment, set the environment variable: To enable this experiment, set the environment variable:
`TASK_X_GENTLE_FORCE=1`. Check out [our guide to enabling experiments](/experiments/#enabling-experiments) for more information. `TASK_X_GENTLE_FORCE=1`. Check out
[our guide to enabling experiments](/experiments/#enabling-experiments) for more
information.
::: :::

View File

@@ -49,18 +49,18 @@ Which method you use depends on how you intend to use the experiment:
export TASK_X_FEATURE=1 export TASK_X_FEATURE=1
``` ```
3. Creating a `.env` or a `.taskrc.yml` file in the same directory as 3. Creating a `.env` or a `.taskrc.yml` file in the same directory as your root
your root Taskfile.\ Taskfile.\
The `.env` file should contain the relevant environment The `.env` file should contain the relevant environment variable(s), while
variable(s), while the `.taskrc.yml` file should use a YAML format the `.taskrc.yml` file should use a YAML format where each experiment is
where each experiment is defined as a key with a corresponding value. defined as a key with a corresponding value.
This allows you to enable an experimental feature at a project level. If you This allows you to enable an experimental feature at a project level. If you
commit this file to source control, then other users of your project will commit this file to source control, then other users of your project will
also have these experiments enabled. also have these experiments enabled.
If both files are present, the values in the `.taskrc.yml` file If both files are present, the values in the `.taskrc.yml` file will take
will take precedence. precedence.
::: code-group ::: code-group
@@ -136,13 +136,13 @@ version.
### 5. Released ### 5. Released
When making a new major release of Task, all experiments marked as `status: When making a new major release of Task, all experiments marked as
stable` will move to `status: released` and their behaviors will become the new `status: stable` will move to `status: released` and their behaviors will become
default in Task. Experiments in an earlier stage (i.e. not stable) cannot be the new default in Task. Experiments in an earlier stage (i.e. not stable)
released and so will continue to be experiments in the new version. cannot be released and so will continue to be experiments in the new version.
### Abandoned / Superseded ### Abandoned / Superseded
If an experiment is unsuccessful at any point then it will be given the `status: If an experiment is unsuccessful at any point then it will be given the
abandoned` or `status: superseded` labels depending on which is more suitable. `status: abandoned` or `status: superseded` labels depending on which is more
These experiments will be removed from Task. suitable. These experiments will be removed from Task.

View File

@@ -17,7 +17,9 @@ environment. They are intended for testing and feedback only.
::: info ::: info
To enable this experiment, set the environment variable: To enable this experiment, set the environment variable:
`TASK_X_REMOTE_TASKFILES=1`. Check out [our guide to enabling experiments](/experiments/#enabling-experiments) for more information. `TASK_X_REMOTE_TASKFILES=1`. Check out
[our guide to enabling experiments](/experiments/#enabling-experiments) for more
information.
::: :::
@@ -59,8 +61,8 @@ git@github.com/go-task/task.git//website/static/Taskfile.yml?ref=main
This is the most basic type of remote node and works by downloading the file This is the most basic type of remote node and works by downloading the file
from the specified URL. The file must be a valid Taskfile and can be of any from the specified URL. The file must be a valid Taskfile and can be of any
name. If a file is not found at the specified URL, Task will append each of the name. If a file is not found at the specified URL, Task will append each of the
supported file names in turn until it finds a valid supported file names in turn until it finds a valid file. If it still does not
file. If it still does not find a valid Taskfile, an error is returned. find a valid Taskfile, an error is returned.
### Git over HTTP ### Git over HTTP
@@ -73,8 +75,8 @@ This is the same URL that you would use to clone the repo over HTTP.
- You can optionally add the path to the Taskfile in the repository by appending - You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL. `//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending - You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch `?ref=<ref>` to the end of the URL. If you omit a reference, the default
will be used. branch will be used.
### Git over SSH ### Git over SSH
@@ -90,11 +92,11 @@ SSH keys added so that they can be used during authentication.
- You can optionally add the path to the Taskfile in the repository by appending - You can optionally add the path to the Taskfile in the repository by appending
`//<path>` to the URL. `//<path>` to the URL.
- You can also optionally specify a branch or tag to use by appending - You can also optionally specify a branch or tag to use by appending
`?ref=<ref>` to the end of the URL. If you omit a reference, the default branch `?ref=<ref>` to the end of the URL. If you omit a reference, the default
will be used. branch will be used.
Task has an example remote Taskfile in our repository Task has an example remote Taskfile in our repository that you can use for
that you can use for testing and that we will use throughout this document: testing and that we will use throughout this document:
```yaml ```yaml
version: '3' version: '3'
@@ -111,10 +113,10 @@ tasks:
## Specifying a remote entrypoint ## Specifying a remote entrypoint
By default, Task will look for one of the supported file By default, Task will look for one of the supported file names on your local
names on your local filesystem. If you want to use a filesystem. If you want to use a remote file instead, you can pass its URI into
remote file instead, you can pass its URI into the `--taskfile`/`-t` flag just the `--taskfile`/`-t` flag just like you would to specify a different local
like you would to specify a different local file. For example: file. For example:
::: code-group ::: code-group
@@ -255,9 +257,8 @@ Task currently supports both `http` and `https` URLs. However, the `http`
requests will not execute by default unless you run the task with the 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 `--insecure` flag. This is to protect you from accidentally running a remote
Taskfile that is downloaded via an unencrypted connection. Sources that are not Taskfile that is downloaded via an unencrypted connection. Sources that are not
protected by TLS are vulnerable to man-in-the-middle protected by TLS are vulnerable to man-in-the-middle attacks and should be
attacks and should be avoided unless you know what avoided unless you know what you are doing.
you are doing.
## Caching & Running Offline ## Caching & Running Offline
@@ -281,11 +282,11 @@ the `--timeout` flag and specifying a duration. For example, `--timeout 5s` will
set the timeout to 5 seconds. set the timeout to 5 seconds.
By default, the cache is stored in the Task temp directory, represented by the By default, the cache is stored in the Task temp directory, represented by the
`TASK_TEMP_DIR` environment variable. You can `TASK_TEMP_DIR` environment variable. You can override the location of the cache
override the location of the cache by setting the `TASK_REMOTE_DIR` environment by setting the `TASK_REMOTE_DIR` environment variable. This way, you can share
variable. This way, you can share the cache between different projects. the cache between different projects.
You can force Task to ignore the cache and download the latest version You can force Task to ignore the cache and download the latest version by using
by using the `--download` flag. the `--download` flag.
You can use the `--clear-cache` flag to clear all cached remote files. You can use the `--clear-cache` flag to clear all cached remote files.

View File

@@ -1,6 +1,8 @@
--- ---
title: FAQ title: FAQ
description: Frequently asked questions about Task, including ETAs, shell limitations, and Windows compatibility description:
Frequently asked questions about Task, including ETAs, shell limitations, and
Windows compatibility
outline: deep outline: deep
--- ---
@@ -103,7 +105,8 @@ If you want to make your Taskfile fully cross-platform, you'll need to work
around this limitation using one of the following methods: around this limitation using one of the following methods:
- Use the <span v-pre>`{{OS}}`</span> function to run an OS-specific script. - Use the <span v-pre>`{{OS}}`</span> function to run an OS-specific script.
- Use something like <span v-pre>`{{if eq OS "windows"}}powershell {{end}}<my_cmd>`</span> to - Use something like
<span v-pre>`{{if eq OS "windows"}}powershell {{end}}<my_cmd>`</span> to
detect windows and run the command in Powershell directly. detect windows and run the command in Powershell directly.
- Use a shell on Windows that supports these commands as builtins, such as [Git - Use a shell on Windows that supports these commands as builtins, such as [Git
Bash][git-bash] or [WSL][wsl]. Bash][git-bash] or [WSL][wsl].

View File

@@ -8,8 +8,8 @@ outline: deep
The following guide will help introduce you to the basics of Task. We'll cover The following guide will help introduce you to the basics of Task. We'll cover
how to create a Taskfile, how to write a basic task and how to call it. If you how to create a Taskfile, how to write a basic task and how to call it. If you
haven't installed Task yet, head over to our [installation haven't installed Task yet, head over to our
guide](installation.md). [installation guide](installation.md).
## Creating your first Taskfile ## Creating your first Taskfile
@@ -49,11 +49,11 @@ tasks:
silent: true silent: true
``` ```
As you can see, all Taskfiles are written in [YAML format](https://yaml.org/). The `version` As you can see, all Taskfiles are written in [YAML format](https://yaml.org/).
attribute specifies the minimum version of Task that can be used to run this The `version` attribute specifies the minimum version of Task that can be used
file. The `vars` attribute is used to define variables that can be used in to run this file. The `vars` attribute is used to define variables that can be
tasks. In this case, we are creating a string variable called `GREETING` with a used in tasks. In this case, we are creating a string variable called `GREETING`
value of `Hello, World!`. with a value of `Hello, World!`.
Finally, the `tasks` attribute is used to define the tasks that can be run. In Finally, the `tasks` attribute is used to define the tasks that can be run. In
this case, we have a task called `default` that echoes the value of the this case, we have a task called `default` that echoes the value of the
@@ -71,10 +71,10 @@ task default
``` ```
Note that we don't have to specify the name of the Taskfile. Task will Note that we don't have to specify the name of the Taskfile. Task will
automatically look for a file called `Taskfile.yml` (or any of Task's [supported automatically look for a file called `Taskfile.yml` (or any of Task's
file names](usage.md#supported-file-names)) in the current directory. Additionally, tasks [supported file names](usage.md#supported-file-names)) in the current directory.
with the name `default` are special. They can also be run without specifying the Additionally, tasks with the name `default` are special. They can also be run
task name. without specifying the task name.
If you created a Taskfile in a different directory, you can run it by passing If you created a Taskfile in a different directory, you can run it by passing
the absolute or relative path to the directory as an argument using the `--dir` the absolute or relative path to the directory as an argument using the `--dir`
@@ -97,10 +97,10 @@ Let's create a task to build a program in Go. Start by adding a new task called
`build` below the existing `default` task. We can then add a `cmds` attribute `build` below the existing `default` task. We can then add a `cmds` attribute
with a single command to build the program. with a single command to build the program.
Task uses [mvdan/sh](https://github.com/mvdan/sh), a native Go sh interpreter. So you can write Task uses [mvdan/sh](https://github.com/mvdan/sh), a native Go sh interpreter.
sh/bash-like commands - even in environments where `sh` or `bash` are usually So you can write sh/bash-like commands - even in environments where `sh` or
not available (like Windows). Just remember any executables called must be `bash` are usually not available (like Windows). Just remember any executables
available as a built-in or in the system's `PATH`. called must be available as a built-in or in the system's `PATH`.
When you're done, it should look something like this: When you're done, it should look something like this:
@@ -129,6 +129,6 @@ task build
That's about it for the basics, but there's _so much_ more that you can do with That's about it for the basics, but there's _so much_ more that you can do with
Task. Check out the rest of the documentation to learn more about all the Task. Check out the rest of the documentation to learn more about all the
features Task has to offer! We recommend taking a look at the [usage features Task has to offer! We recommend taking a look at the
guide](usage.md) next. Alternatively, you can check out our reference docs for the [usage guide](usage.md) next. Alternatively, you can check out our reference
[Taskfile schema](reference/schema.md) and [CLI](reference/cli.md). docs for the [Taskfile schema](reference/schema.md) and [CLI](reference/cli.md).

View File

@@ -10,8 +10,9 @@ Task offers many installation methods. Check out the available methods below.
::: info ::: info
Some of the methods below are marked as ![Community](https://img.shields.io/badge/Community%20Owned-orange). This means they Some of the methods below are marked as
are not maintained by the Task team and may not be up-to-date. ![Community](https://img.shields.io/badge/Community%20Owned-orange). This means
they are not maintained by the Task team and may not be up-to-date.
::: :::
@@ -19,15 +20,17 @@ are not maintained by the Task team and may not be up-to-date.
### [Homebrew](https://brew.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#homebrew} ### [Homebrew](https://brew.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#homebrew}
Task is available via our official Homebrew tap [[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]: Task is available via our official Homebrew tap
[[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]:
```shell ```shell
brew install go-task/tap/go-task brew install go-task/tap/go-task
``` ```
Alternatively it can be installed from the official Homebrew Alternatively it can be installed from the official Homebrew repository
repository [[package](https://formulae.brew.sh/formula/go-task)] [[package](https://formulae.brew.sh/formula/go-task)]
[[source](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go-task.rb)] by running: [[source](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go-task.rb)]
by running:
```shell ```shell
brew install go-task brew install go-task
@@ -35,7 +38,9 @@ brew install go-task
### [Macports](https://macports.org) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#macports} ### [Macports](https://macports.org) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#macports}
Task repository is tracked by Macports [[package](https://ports.macports.org/port/go-task/details/)] [[source](https://github.com/macports/macports-ports/blob/master/devel/go-task/Portfile)]: Task repository is tracked by Macports
[[package](https://ports.macports.org/port/go-task/details/)]
[[source](https://github.com/macports/macports-ports/blob/master/devel/go-task/Portfile)]:
```shell ```shell
port install go-task port install go-task
@@ -43,8 +48,10 @@ port install go-task
### [Snap](https://snapcraft.io/task) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#snap} ### [Snap](https://snapcraft.io/task) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) {#snap}
Task is available on [Snapcraft](https://snapcraft.io/task) [[source](https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml)], but keep in mind that your Linux Task is available on [Snapcraft](https://snapcraft.io/task)
distribution should allow classic confinement for Snaps to Task work correctly: [[source](https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml)], but
keep in mind that your Linux distribution should allow classic confinement for
Snaps to Task work correctly:
```shell ```shell
sudo snap install task --classic sudo snap install task --classic
@@ -54,7 +61,8 @@ sudo snap install task --classic
Npm can be used as cross-platform way to install Task globally or as a Npm can be used as cross-platform way to install Task globally or as a
dependency of your project dependency of your project
[[package](https://www.npmjs.com/package/@go-task/cli)] [[source](https://github.com/go-task/task/blob/main/package.json)]: [[package](https://www.npmjs.com/package/@go-task/cli)]
[[source](https://github.com/go-task/task/blob/main/package.json)]:
```shell ```shell
npm install -g @go-task/cli npm install -g @go-task/cli
@@ -63,7 +71,8 @@ npm install -g @go-task/cli
### [pip](https://pip.pypa.io) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pip} ### [pip](https://pip.pypa.io) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pip}
Like npm, pip can be used as a cross-platform way to install Task Like npm, pip can be used as a cross-platform way to install Task
[[package](https://pypi.org/project/go-task-bin)] [[source](https://github.com/Bing-su/pip-binary-factory/tree/main/task)]: [[package](https://pypi.org/project/go-task-bin)]
[[source](https://github.com/Bing-su/pip-binary-factory/tree/main/task)]:
```shell ```shell
pip install go-task-bin pip install go-task-bin
@@ -71,7 +80,9 @@ pip install go-task-bin
### [WinGet](https://github.com/microsoft/winget-cli) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) {#winget} ### [WinGet](https://github.com/microsoft/winget-cli) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) {#winget}
Task is available via the [community repository](https://github.com/microsoft/winget-pkgs) [[source](https://github.com/microsoft/winget-pkgs/tree/master/manifests/t/Task/Task)]: Task is available via the
[community repository](https://github.com/microsoft/winget-pkgs)
[[source](https://github.com/microsoft/winget-pkgs/tree/master/manifests/t/Task/Task)]:
```shell ```shell
winget install Task.Task winget install Task.Task
@@ -79,7 +90,8 @@ winget install Task.Task
### [Chocolatey](https://chocolatey.org) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#chocolatey} ### [Chocolatey](https://chocolatey.org) ![Windows](https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#chocolatey}
[[package](https://community.chocolatey.org/packages/go-task)] [[source](https://github.com/Starz0r/ChocolateyPackagingScripts/blob/master/src/go-task_gh_build.py)] [[package](https://community.chocolatey.org/packages/go-task)]
[[source](https://github.com/Starz0r/ChocolateyPackagingScripts/blob/master/src/go-task_gh_build.py)]
```shell ```shell
choco install go-task choco install go-task
@@ -95,7 +107,8 @@ scoop install task
### Arch ([pacman](https://wiki.archlinux.org/title/Pacman)) ![Arch Linux](https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#arch} ### Arch ([pacman](https://wiki.archlinux.org/title/Pacman)) ![Arch Linux](https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#arch}
[[package](https://archlinux.org/packages/extra/x86_64/go-task/)] [[source](https://gitlab.archlinux.org/archlinux/packaging/packages/go-task)] [[package](https://archlinux.org/packages/extra/x86_64/go-task/)]
[[source](https://gitlab.archlinux.org/archlinux/packaging/packages/go-task)]
```shell ```shell
pacman -S go-task pacman -S go-task
@@ -103,7 +116,8 @@ pacman -S go-task
### Fedora ([dnf](https://docs.fedoraproject.org/en-US/quick-docs/dnf)) ![Fedora](https://img.shields.io/badge/Fedora-51A2DA?logo=fedora&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#fedora} ### Fedora ([dnf](https://docs.fedoraproject.org/en-US/quick-docs/dnf)) ![Fedora](https://img.shields.io/badge/Fedora-51A2DA?logo=fedora&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#fedora}
[[package](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)] [[source](https://src.fedoraproject.org/rpms/golang-github-task)] [[package](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)]
[[source](https://src.fedoraproject.org/rpms/golang-github-task)]
```shell ```shell
dnf install go-task dnf install go-task
@@ -111,7 +125,8 @@ dnf install go-task
### FreeBSD ([Ports](https://ports.freebsd.org/cgi/ports.cgi)) ![FreeBSD](https://img.shields.io/badge/FreeBSD-990000?logo=freebsd&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#freebsd} ### FreeBSD ([Ports](https://ports.freebsd.org/cgi/ports.cgi)) ![FreeBSD](https://img.shields.io/badge/FreeBSD-990000?logo=freebsd&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#freebsd}
[[package](https://cgit.freebsd.org/ports/tree/devel/task)] [[source](https://cgit.freebsd.org/ports/tree/devel/task/Makefile)] [[package](https://cgit.freebsd.org/ports/tree/devel/task)]
[[source](https://cgit.freebsd.org/ports/tree/devel/task/Makefile)]
```shell ```shell
pkg install task pkg install task
@@ -127,7 +142,8 @@ nix-env -iA nixpkgs.go-task
### [pacstall](https://github.com/pacstall/pacstall) ![Debian](https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff) ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pacstall} ### [pacstall](https://github.com/pacstall/pacstall) ![Debian](https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff) ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=fff) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pacstall}
[[package](https://pacstall.dev/packages/go-task-deb)] [[source](https://github.com/pacstall/pacstall-programs/blob/master/packages/go-task-deb/go-task-deb.pacscript)] [[package](https://pacstall.dev/packages/go-task-deb)]
[[source](https://github.com/pacstall/pacstall-programs/blob/master/packages/go-task-deb/go-task-deb.pacscript)]
```shell ```shell
pacstall -I go-task-deb pacstall -I go-task-deb
@@ -135,7 +151,8 @@ pacstall -I go-task-deb
### [pkgx](https://pkgx.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pkgx} ### [pkgx](https://pkgx.sh) ![macOS](https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0) ![Linux](https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black) ![Community](https://img.shields.io/badge/Community%20Owned-orange) {#pkgx}
[[package](https://pkgx.dev/pkgs/taskfile.dev)] [[source](https://github.com/pkgxdev/pantry/blob/main/projects/taskfile.dev/package.yml)] [[package](https://pkgx.dev/pkgs/taskfile.dev)]
[[source](https://github.com/pkgxdev/pantry/blob/main/projects/taskfile.dev/package.yml)]
```shell ```shell
pkgx task pkgx task
@@ -151,8 +168,9 @@ task
### Binary ### Binary
You can download the binary from the [releases page on GitHub](https://github.com/go-task/task/releases) and add You can download the binary from the
to your `$PATH`. [releases page on GitHub](https://github.com/go-task/task/releases) and add to
your `$PATH`.
DEB and RPM packages are also available. DEB and RPM packages are also available.
@@ -160,9 +178,11 @@ The `task_checksums.txt` file contains the SHA-256 checksum for each file.
### Install Script ### Install Script
We also have an [install script](https://github.com/go-task/task/blob/main/install-task.sh) which is very useful in We also have an
scenarios like CI. Many thanks to [GoDownloader](https://github.com/goreleaser/godownloader) for enabling the [install script](https://github.com/go-task/task/blob/main/install-task.sh)
easy generation of this script. which is very useful in scenarios like CI. Many thanks to
[GoDownloader](https://github.com/goreleaser/godownloader) for enabling the easy
generation of this script.
By default, it installs on the `./bin` directory relative to the working By default, it installs on the `./bin` directory relative to the working
directory: directory:
@@ -186,15 +206,16 @@ default.
::: :::
By default, it installs the latest version available. By default, it installs the latest version available. You can also specify a tag
You can also specify a tag (available in [releases](https://github.com/go-task/task/releases)) (available in [releases](https://github.com/go-task/task/releases)) to install a
to install a specific version: specific version:
```shell ```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0 sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0
``` ```
Parameters are order specific, to set both installation directory and version: Parameters are order specific, to set both installation directory and version:
```shell ```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin v3.42.1 sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin v3.42.1
``` ```
@@ -218,8 +239,8 @@ This installation method is community owned.
### Go Modules ### Go Modules
Ensure that you have a supported version of [Go](https://golang.org) properly installed and Ensure that you have a supported version of [Go](https://golang.org) properly
setup. You can find the minimum required version of Go in the installed and setup. You can find the minimum required version of Go in the
[go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file. [go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
You can then install the latest release globally by running: You can then install the latest release globally by running:

View File

@@ -1,6 +1,8 @@
--- ---
title: Integrations title: Integrations
description: Official and community integrations for Task, including VS Code, JSON schemas, and other tools description:
Official and community integrations for Task, including VS Code, JSON schemas,
and other tools
outline: deep outline: deep
--- ---

View File

@@ -15,7 +15,8 @@ task [options] [tasks...] [-- CLI_ARGS...]
::: tip ::: tip
If `--` is given, all remaining arguments will be assigned to a special `CLI_ARGS` variable If `--` is given, all remaining arguments will be assigned to a special
`CLI_ARGS` variable
::: :::
@@ -252,7 +253,8 @@ task build --watch
#### `-I, --interval <duration>` #### `-I, --interval <duration>`
Set watch interval (default: `5s`). Must be a valid [Go duration](https://pkg.go.dev/time#ParseDuration). Set watch interval (default: `5s`). Must be a valid
[Go duration](https://pkg.go.dev/time#ParseDuration).
```bash ```bash
task build --watch --interval 1s task build --watch --interval 1s
@@ -273,12 +275,15 @@ task deploy --yes
Task uses specific exit codes to indicate different types of errors: Task uses specific exit codes to indicate different types of errors:
### Success ### Success
- **0** - Success - **0** - Success
### General Errors (1-99) ### General Errors (1-99)
- **1** - Unknown error occurred - **1** - Unknown error occurred
### Taskfile Errors (100-199) ### Taskfile Errors (100-199)
- **100** - No Taskfile found - **100** - No Taskfile found
- **101** - Taskfile already exists (when using `--init`) - **101** - Taskfile already exists (when using `--init`)
- **102** - Invalid or unparseable Taskfile - **102** - Invalid or unparseable Taskfile
@@ -289,6 +294,7 @@ Task uses specific exit codes to indicate different types of errors:
- **107** - No schema version defined in Taskfile - **107** - No schema version defined in Taskfile
### Task Errors (200-255) ### Task Errors (200-255)
- **200** - Task not found - **200** - Task not found
- **201** - Command execution error - **201** - Command execution error
- **202** - Attempted to run internal task - **202** - Attempted to run internal task
@@ -300,13 +306,15 @@ Task uses specific exit codes to indicate different types of errors:
::: info ::: info
When using `-x/--exit-code`, failed command exit codes are passed through instead of the above codes. When using `-x/--exit-code`, failed command exit codes are passed through
instead of the above codes.
::: :::
::: tip ::: tip
The complete list of exit codes is available in the repository at [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go). The complete list of exit codes is available in the repository at
[`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
::: :::

View File

@@ -41,7 +41,8 @@ allows the user to fetch and execute tasks from a Taskfile.
::: info ::: info
This is the package which is most likely to be the subject of breaking changes as we refine the API. This is the package which is most likely to be the subject of breaking changes
as we refine the API.
::: :::
@@ -139,30 +140,42 @@ namespaces and tasks from all the Taskfiles we read.
::: info ::: info
We plan to remove AST merging in the future as it is unnecessarily complex and causes lots of issues with scoping. We plan to remove AST merging in the future as it is unnecessarily complex and
causes lots of issues with scoping.
::: :::
[`github.com/go-task/task/v3`]: https://pkg.go.dev/github.com/go-task/task/v3 [`github.com/go-task/task/v3`]: https://pkg.go.dev/github.com/go-task/task/v3
[`github.com/go-task/task/v3/taskfile`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile [`github.com/go-task/task/v3/taskfile`]:
[`github.com/go-task/task/v3/taskfile/ast`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast https://pkg.go.dev/github.com/go-task/task/v3/taskfile
[`github.com/go-task/task/v3/errors`]: https://pkg.go.dev/github.com/go-task/task/v3/errors [`github.com/go-task/task/v3/taskfile/ast`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast
[`ast.TaskfileGraph`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#TaskfileGraph [`github.com/go-task/task/v3/errors`]:
[`ast.Taskfile`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#Taskfile https://pkg.go.dev/github.com/go-task/task/v3/errors
[`ast.TaskfileGraph`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#TaskfileGraph
[`ast.Taskfile`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile/ast#Taskfile
[`taskfile.Node`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Node [`taskfile.Node`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Node
[`taskfile.FileNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#FileNode [`taskfile.FileNode`]:
[`taskfile.HTTPNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#HTTPNode https://pkg.go.dev/github.com/go-task/task/v3/taskfile#FileNode
[`taskfile.GitNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#GitNode [`taskfile.HTTPNode`]:
[`taskfile.StdinNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#StdinNode https://pkg.go.dev/github.com/go-task/task/v3/taskfile#HTTPNode
[`taskfile.NewFileNode`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewFileNode [`taskfile.GitNode`]:
[`taskfile.Reader`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Reader https://pkg.go.dev/github.com/go-task/task/v3/taskfile#GitNode
[`taskfile.NewReader`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewReader [`taskfile.StdinNode`]:
[`taskfile.Snippet`]: https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Snippet https://pkg.go.dev/github.com/go-task/task/v3/taskfile#StdinNode
[`taskfile.NewFileNode`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewFileNode
[`taskfile.Reader`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Reader
[`taskfile.NewReader`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#NewReader
[`taskfile.Snippet`]:
https://pkg.go.dev/github.com/go-task/task/v3/taskfile#Snippet
[`task.Executor`]: https://pkg.go.dev/github.com/go-task/task/v3#Executor [`task.Executor`]: https://pkg.go.dev/github.com/go-task/task/v3#Executor
[`task.Formatter`]: https://pkg.go.dev/github.com/go-task/task/v3#Formatter [`task.Formatter`]: https://pkg.go.dev/github.com/go-task/task/v3#Formatter
[`errors.TaskError`]: https://pkg.go.dev/github.com/go-task/task/v3/errors#TaskError [`errors.TaskError`]:
https://pkg.go.dev/github.com/go-task/task/v3/errors#TaskError
[`error`]: https://pkg.go.dev/builtin#error [`error`]: https://pkg.go.dev/builtin#error
[ast]: https://en.wikipedia.org/wiki/Abstract_syntax_tree [ast]: https://en.wikipedia.org/wiki/Abstract_syntax_tree

View File

@@ -1,12 +1,15 @@
--- ---
title: Schema Reference title: Schema Reference
description: Complete reference for the Taskfile schema based on the official JSON schema description:
Complete reference for the Taskfile schema based on the official JSON schema
outline: deep outline: deep
--- ---
# Schema Reference # Schema Reference
This page documents all available properties and types for the Taskfile schema version 3, based on the [official JSON schema](https://taskfile.dev/schema.json). This page documents all available properties and types for the Taskfile schema
version 3, based on the
[official JSON schema](https://taskfile.dev/schema.json).
## Root Schema ## Root Schema
@@ -186,7 +189,8 @@ interval: 1s
### `set` ### `set`
- **Type**: `[]string` - **Type**: `[]string`
- **Options**: `allexport`, `a`, `errexit`, `e`, `noexec`, `n`, `noglob`, `f`, `nounset`, `u`, `xtrace`, `x`, `pipefail` - **Options**: `allexport`, `a`, `errexit`, `e`, `noexec`, `n`, `noglob`, `f`,
`nounset`, `u`, `xtrace`, `x`, `pipefail`
- **Description**: POSIX shell options for all commands - **Description**: POSIX shell options for all commands
```yaml ```yaml
@@ -322,7 +326,8 @@ includes:
## Variable ## Variable
Variables support multiple types and can be static values, dynamic commands, references, or maps. Variables support multiple types and can be static values, dynamic commands,
references, or maps.
### Static Variables ### Static Variables
@@ -381,7 +386,7 @@ Variables can reference previously defined variables:
vars: vars:
GREETING: Hello GREETING: Hello
TARGET: World TARGET: World
MESSAGE: "{{.GREETING}} {{.TARGET}}!" MESSAGE: '{{.GREETING}} {{.TARGET}}!'
``` ```
## Task ## Task
@@ -470,7 +475,7 @@ tasks:
- for: [unit, integration, e2e] - for: [unit, integration, e2e]
task: test task: test
vars: vars:
TEST_TYPE: "{{.ITEM}}" TEST_TYPE: '{{.ITEM}}'
cmds: cmds:
- echo "All tests completed" - echo "All tests completed"
``` ```
@@ -539,10 +544,10 @@ tasks:
tasks: tasks:
build: build:
sources: sources:
- "**/*.go" - '**/*.go'
- go.mod - go.mod
# With exclusions # With exclusions
- exclude: "**/*_test.go" - exclude: '**/*_test.go'
cmds: cmds:
- go build ./... - go build ./...
``` ```
@@ -555,10 +560,10 @@ tasks:
```yaml ```yaml
tasks: tasks:
build: build:
sources: ["**/*.go"] sources: ['**/*.go']
generates: generates:
- "./app" - './app'
- exclude: "*.debug" - exclude: '*.debug'
cmds: cmds:
- go build -o app ./cmd - go build -o app ./cmd
``` ```
@@ -596,7 +601,7 @@ tasks:
deploy: deploy:
preconditions: preconditions:
- sh: test -n "$API_KEY" - sh: test -n "$API_KEY"
msg: "API_KEY environment variable is required" msg: 'API_KEY environment variable is required'
- sh: test -f ./app - sh: test -f ./app
msg: "Application binary not found. Run 'task build' first." msg: "Application binary not found. Run 'task build' first."
cmds: cmds:
@@ -736,7 +741,7 @@ tasks:
```yaml ```yaml
tasks: tasks:
process-files: process-files:
sources: ["*.txt"] sources: ['*.txt']
cmds: cmds:
- for: sources - for: sources
cmd: wc -l {{.ITEM}} cmd: wc -l {{.ITEM}}
@@ -750,11 +755,11 @@ tasks:
tasks: tasks:
process-items: process-items:
vars: vars:
ITEMS: "item1,item2,item3" ITEMS: 'item1,item2,item3'
cmds: cmds:
- for: - for:
var: ITEMS var: ITEMS
split: "," split: ','
as: CURRENT as: CURRENT
cmd: echo "Processing {{.CURRENT}}" cmd: echo "Processing {{.CURRENT}}"
``` ```
@@ -781,10 +786,9 @@ tasks:
- for: [frontend, backend, worker] - for: [frontend, backend, worker]
task: build task: build
vars: vars:
SERVICE: "{{.ITEM}}" SERVICE: '{{.ITEM}}'
``` ```
## Shell Options ## Shell Options
### Set Options ### Set Options

View File

@@ -1,16 +1,23 @@
--- ---
title: Templating Reference title: Templating Reference
description: Comprehensive guide to Task's templating system with Go text/template, special variables, and available functions description:
Comprehensive guide to Task's templating system with Go text/template, special
variables, and available functions
outline: deep outline: deep
--- ---
# Templating Reference # Templating Reference
Task's templating engine uses Go's [text/template](https://pkg.go.dev/text/template) package to interpolate values. This reference covers the main features and all available functions for creating dynamic Taskfiles. Task's templating engine uses Go's
[text/template](https://pkg.go.dev/text/template) package to interpolate values.
This reference covers the main features and all available functions for creating
dynamic Taskfiles.
## Basic Usage ## Basic Usage
Most string values in Task can be templated using double curly braces <span v-pre>`{{` and `}}`</span>. Anything inside the braces is executed as a Go template. Most string values in Task can be templated using double curly braces
<span v-pre>`{{` and `}}`</span>. Anything inside the braces is executed as a Go
template.
### Simple Variable Interpolation ### Simple Variable Interpolation
@@ -26,6 +33,7 @@ tasks:
``` ```
**Output:** **Output:**
``` ```
Hello, World! Hello, World!
``` ```
@@ -46,6 +54,7 @@ tasks:
``` ```
**Output:** **Output:**
``` ```
:) :)
``` ```
@@ -64,6 +73,7 @@ tasks:
``` ```
**Output:** **Output:**
``` ```
0, 1, 2, 3 0, 1, 2, 3
``` ```
@@ -86,6 +96,7 @@ tasks:
``` ```
**Output:** **Output:**
``` ```
0: 0 0: 0
1: 1 1: 1
@@ -95,11 +106,13 @@ tasks:
## Special Variables ## Special Variables
Task provides special variables that are always available in templates. These override any user-defined variables with the same name. Task provides special variables that are always available in templates. These
override any user-defined variables with the same name.
### CLI ### CLI
#### `CLI_ARGS` #### `CLI_ARGS`
- **Type**: `string` - **Type**: `string`
- **Description**: All extra arguments passed after `--` as a string - **Description**: All extra arguments passed after `--` as a string
@@ -116,6 +129,7 @@ task test -- -v -race
``` ```
#### `CLI_ARGS_LIST` #### `CLI_ARGS_LIST`
- **Type**: `[]string` - **Type**: `[]string`
- **Description**: All extra arguments passed after `--` as a shell parsed list - **Description**: All extra arguments passed after `--` as a shell parsed list
@@ -127,6 +141,7 @@ tasks:
``` ```
#### `CLI_FORCE` #### `CLI_FORCE`
- **Type**: `bool` - **Type**: `bool`
- **Description**: Whether `--force` or `--force-all` flags were set - **Description**: Whether `--force` or `--force-all` flags were set
@@ -142,20 +157,24 @@ tasks:
``` ```
#### `CLI_SILENT` #### `CLI_SILENT`
- **Type**: `bool` - **Type**: `bool`
- **Description**: Whether `--silent` flag was set - **Description**: Whether `--silent` flag was set
#### `CLI_VERBOSE` #### `CLI_VERBOSE`
- **Type**: `bool` - **Type**: `bool`
- **Description**: Whether `--verbose` flag was set - **Description**: Whether `--verbose` flag was set
#### `CLI_OFFLINE` #### `CLI_OFFLINE`
- **Type**: `bool` - **Type**: `bool`
- **Description**: Whether `--offline` flag was set - **Description**: Whether `--offline` flag was set
### Task ### Task
#### `TASK` #### `TASK`
- **Type**: `string` - **Type**: `string`
- **Description**: Name of the current task - **Description**: Name of the current task
@@ -167,10 +186,12 @@ tasks:
``` ```
#### `ALIAS` #### `ALIAS`
- **Type**: `string` - **Type**: `string`
- **Description**: Alias used for the current task, otherwise matches `TASK` - **Description**: Alias used for the current task, otherwise matches `TASK`
#### `TASK_EXE` #### `TASK_EXE`
- **Type**: `string` - **Type**: `string`
- **Description**: Task executable name or path - **Description**: Task executable name or path
@@ -184,26 +205,32 @@ tasks:
### File Paths ### File Paths
#### `ROOT_TASKFILE` #### `ROOT_TASKFILE`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path of the root Taskfile - **Description**: Absolute path of the root Taskfile
#### `ROOT_DIR` #### `ROOT_DIR`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path of the root Taskfile directory - **Description**: Absolute path of the root Taskfile directory
#### `TASKFILE` #### `TASKFILE`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path of the current (included) Taskfile - **Description**: Absolute path of the current (included) Taskfile
#### `TASKFILE_DIR` #### `TASKFILE_DIR`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path of the current Taskfile directory - **Description**: Absolute path of the current Taskfile directory
#### `TASK_DIR` #### `TASK_DIR`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path where the task is executed - **Description**: Absolute path where the task is executed
#### `USER_WORKING_DIR` #### `USER_WORKING_DIR`
- **Type**: `string` - **Type**: `string`
- **Description**: Absolute path where `task` was called from - **Description**: Absolute path where `task` was called from
@@ -219,18 +246,22 @@ tasks:
### Status ### Status
#### `CHECKSUM` #### `CHECKSUM`
- **Type**: `string` - **Type**: `string`
- **Description**: Checksum of files in `sources` (only in `status` with `checksum` method) - **Description**: Checksum of files in `sources` (only in `status` with
`checksum` method)
#### `TIMESTAMP` #### `TIMESTAMP`
- **Type**: `time.Time` - **Type**: `time.Time`
- **Description**: Greatest timestamp of files in `sources` (only in `status` with `timestamp` method) - **Description**: Greatest timestamp of files in `sources` (only in `status`
with `timestamp` method)
```yaml ```yaml
tasks: tasks:
build: build:
method: checksum method: checksum
sources: ["**/*.go"] sources: ['**/*.go']
status: status:
- test "{{.CHECKSUM}}" = "$(cat .last-checksum)" - test "{{.CHECKSUM}}" = "$(cat .last-checksum)"
cmds: cmds:
@@ -241,6 +272,7 @@ tasks:
### Loop ### Loop
#### `ITEM` #### `ITEM`
- **Type**: `any` - **Type**: `any`
- **Description**: Current iteration value when using `for` property - **Description**: Current iteration value when using `for` property
@@ -267,8 +299,10 @@ tasks:
### Defer ### Defer
#### `EXIT_CODE` #### `EXIT_CODE`
- **Type**: `int` - **Type**: `int`
- **Description**: Failed command exit code (only in `defer`, only when non-zero) - **Description**: Failed command exit code (only in `defer`, only when
non-zero)
```yaml ```yaml
tasks: tasks:
@@ -285,6 +319,7 @@ tasks:
### System ### System
#### `TASK_VERSION` #### `TASK_VERSION`
- **Type**: `string` - **Type**: `string`
- **Description**: Current version of Task - **Description**: Current version of Task
@@ -297,26 +332,33 @@ tasks:
## Built-in Functions ## Built-in Functions
These functions are provided by Go's [text/template](https://pkg.go.dev/text/template#hdr-Functions) package. These functions are provided by Go's
[text/template](https://pkg.go.dev/text/template#hdr-Functions) package.
### Logic Functions ### Logic Functions
#### `and` #### `and`
Boolean AND operation Boolean AND operation
```yaml ```yaml
cmds: cmds:
- echo "{{if and .DEBUG .VERBOSE}}Debug mode{{end}}" - echo "{{if and .DEBUG .VERBOSE}}Debug mode{{end}}"
``` ```
#### `or` #### `or`
Boolean OR operation Boolean OR operation
```yaml ```yaml
cmds: cmds:
- echo "{{if or .DEV .STAGING}}Non-production{{end}}" - echo "{{if or .DEV .STAGING}}Non-production{{end}}"
``` ```
#### `not` #### `not`
Boolean negation Boolean negation
```yaml ```yaml
cmds: cmds:
- echo "{{if not .PRODUCTION}}Development build{{end}}" - echo "{{if not .PRODUCTION}}Development build{{end}}"
@@ -325,7 +367,9 @@ cmds:
### Data Access ### Data Access
#### `index` #### `index`
Access array/map elements Access array/map elements
```yaml ```yaml
vars: vars:
SERVICES: [api, web, worker] SERVICES: [api, web, worker]
@@ -334,7 +378,9 @@ cmds:
``` ```
#### `len` #### `len`
Get length of arrays, maps, or strings Get length of arrays, maps, or strings
```yaml ```yaml
vars: vars:
ITEMS: [a, b, c, d] ITEMS: [a, b, c, d]
@@ -343,7 +389,9 @@ cmds:
``` ```
#### `slice` #### `slice`
Get slice of array/string Get slice of array/string
```yaml ```yaml
vars: vars:
ITEMS: [a, b, c, d, e] ITEMS: [a, b, c, d, e]
@@ -354,7 +402,9 @@ cmds:
### Output Functions ### Output Functions
#### `print`, `printf`, `println` #### `print`, `printf`, `println`
Formatted output functions Formatted output functions
```yaml ```yaml
cmds: cmds:
- echo "{{printf "Version: %s.%d" .VERSION .BUILD}}" - echo "{{printf "Version: %s.%d" .VERSION .BUILD}}"
@@ -362,7 +412,8 @@ cmds:
## Slim-Sprig Functions ## Slim-Sprig Functions
Task includes functions from [slim-sprig](https://go-task.github.io/slim-sprig/) for enhanced templating capabilities. Task includes functions from [slim-sprig](https://go-task.github.io/slim-sprig/)
for enhanced templating capabilities.
### String Functions ### String Functions
@@ -372,8 +423,8 @@ Task includes functions from [slim-sprig](https://go-task.github.io/slim-sprig/)
tasks: tasks:
string-demo: string-demo:
vars: vars:
MESSAGE: " Hello World " MESSAGE: ' Hello World '
NAME: "john doe" NAME: 'john doe'
cmds: cmds:
- echo "{{.MESSAGE | trim}}" # "Hello World" - echo "{{.MESSAGE | trim}}" # "Hello World"
- echo "{{.NAME | title}}" # "John Doe" - echo "{{.NAME | title}}" # "John Doe"
@@ -387,7 +438,7 @@ tasks:
tasks: tasks:
check: check:
vars: vars:
FILENAME: "app.tar.gz" FILENAME: 'app.tar.gz'
cmds: cmds:
- | - |
{{if .FILENAME | hasPrefix "app"}} {{if .FILENAME | hasPrefix "app"}}
@@ -405,7 +456,7 @@ tasks:
tasks: tasks:
process: process:
vars: vars:
TEXT: "Hello, World!" TEXT: 'Hello, World!'
cmds: cmds:
- echo "{{.TEXT | replace "," ""}}" # "Hello World!" - echo "{{.TEXT | replace "," ""}}" # "Hello World!"
- echo "{{.TEXT | quote}}" # "\"Hello, World!\"" - echo "{{.TEXT | quote}}" # "\"Hello, World!\""
@@ -419,8 +470,8 @@ tasks:
tasks: tasks:
regex-demo: regex-demo:
vars: vars:
EMAIL: "user@example.com" EMAIL: 'user@example.com'
TEXT: "abc123def456" TEXT: 'abc123def456'
cmds: cmds:
- echo "{{regexMatch "@" .EMAIL}}" # true - echo "{{regexMatch "@" .EMAIL}}" # true
- echo "{{regexFind "[0-9]+" .TEXT}}" # "123" - echo "{{regexFind "[0-9]+" .TEXT}}" # "123"
@@ -451,7 +502,7 @@ tasks:
manipulate: manipulate:
vars: vars:
NUMBERS: [3, 1, 4, 1, 5, 9, 1] NUMBERS: [3, 1, 4, 1, 5, 9, 1]
FRUITS: ["apple", "banana"] FRUITS: ['apple', 'banana']
cmds: cmds:
- echo "{{.NUMBERS | uniq}}" # [3, 1, 4, 5, 9] - echo "{{.NUMBERS | uniq}}" # [3, 1, 4, 5, 9]
- echo "{{.NUMBERS | sortAlpha}}" # [1, 1, 1, 3, 4, 5, 9] - echo "{{.NUMBERS | sortAlpha}}" # [1, 1, 1, 3, 4, 5, 9]
@@ -465,8 +516,8 @@ tasks:
tasks: tasks:
string-lists: string-lists:
vars: vars:
CSV: "apple,banana,cherry" CSV: 'apple,banana,cherry'
WORDS: ["hello", "world", "from", "task"] WORDS: ['hello', 'world', 'from', 'task']
cmds: cmds:
- echo "{{.CSV | splitList ","}}" # ["apple", "banana", "cherry"] - echo "{{.CSV | splitList ","}}" # ["apple", "banana", "cherry"]
- echo "{{.WORDS | join " "}}" # "hello world from task" - echo "{{.WORDS | join " "}}" # "hello world from task"
@@ -548,8 +599,8 @@ tasks:
encoding: encoding:
vars: vars:
DATA: DATA:
name: "Task" name: 'Task'
version: "3.0" version: '3.0'
cmds: cmds:
- echo "{{.DATA | toJson}}" - echo "{{.DATA | toJson}}"
- echo "{{.DATA | toPrettyJson}}" - echo "{{.DATA | toPrettyJson}}"
@@ -563,8 +614,8 @@ tasks:
tasks: tasks:
convert: convert:
vars: vars:
NUM_STR: "42" NUM_STR: '42'
FLOAT_STR: "3.14" FLOAT_STR: '3.14'
ITEMS: [1, 2, 3] ITEMS: [1, 2, 3]
cmds: cmds:
- echo "{{.NUM_STR | atoi | add 8}}" # 50 - echo "{{.NUM_STR | atoi | add 8}}" # 50
@@ -579,7 +630,9 @@ Task provides additional functions for common operations.
### System Functions ### System Functions
#### `OS` #### `OS`
Get the operating system Get the operating system
```yaml ```yaml
tasks: tasks:
build: build:
@@ -593,7 +646,9 @@ tasks:
``` ```
#### `ARCH` #### `ARCH`
Get the system architecture Get the system architecture
```yaml ```yaml
tasks: tasks:
info: info:
@@ -602,7 +657,9 @@ tasks:
``` ```
#### `numCPU` #### `numCPU`
Get number of CPU cores Get number of CPU cores
```yaml ```yaml
tasks: tasks:
test: test:
@@ -613,7 +670,9 @@ tasks:
### Path Functions ### Path Functions
#### `toSlash` / `fromSlash` #### `toSlash` / `fromSlash`
Convert path separators Convert path separators
```yaml ```yaml
tasks: tasks:
paths: paths:
@@ -624,7 +683,9 @@ tasks:
``` ```
#### `joinPath` #### `joinPath`
Join path elements Join path elements
```yaml ```yaml
tasks: tasks:
build: build:
@@ -636,7 +697,9 @@ tasks:
``` ```
#### `relPath` #### `relPath`
Get relative path Get relative path
```yaml ```yaml
tasks: tasks:
info: info:
@@ -647,7 +710,9 @@ tasks:
### String Processing ### String Processing
#### `splitLines` #### `splitLines`
Split on newlines (Unix and Windows) Split on newlines (Unix and Windows)
```yaml ```yaml
tasks: tasks:
process: process:
@@ -664,7 +729,9 @@ tasks:
``` ```
#### `catLines` #### `catLines`
Replace newlines with spaces Replace newlines with spaces
```yaml ```yaml
tasks: tasks:
flatten: flatten:
@@ -677,19 +744,23 @@ tasks:
``` ```
#### `shellQuote` (alias: `q`) #### `shellQuote` (alias: `q`)
Quote for shell safety Quote for shell safety
```yaml ```yaml
tasks: tasks:
safe: safe:
vars: vars:
FILENAME: "file with spaces.txt" FILENAME: 'file with spaces.txt'
cmds: cmds:
- ls -la {{.FILENAME | shellQuote}} - ls -la {{.FILENAME | shellQuote}}
- cat {{.FILENAME | q}} # Short alias - cat {{.FILENAME | q}} # Short alias
``` ```
#### `splitArgs` #### `splitArgs`
Parse shell arguments Parse shell arguments
```yaml ```yaml
tasks: tasks:
parse: parse:
@@ -705,7 +776,9 @@ tasks:
### Data Functions ### Data Functions
#### `merge` #### `merge`
Merge maps Merge maps
```yaml ```yaml
tasks: tasks:
config: config:
@@ -721,7 +794,9 @@ tasks:
``` ```
#### `spew` #### `spew`
Debug variable contents Debug variable contents
```yaml ```yaml
tasks: tasks:
debug: debug:
@@ -737,7 +812,9 @@ tasks:
### YAML Functions ### YAML Functions
#### `fromYaml` / `toYaml` #### `fromYaml` / `toYaml`
YAML encoding/decoding YAML encoding/decoding
```yaml ```yaml
tasks: tasks:
yaml-demo: yaml-demo:
@@ -754,7 +831,9 @@ tasks:
### Utility Functions ### Utility Functions
#### `uuid` #### `uuid`
Generate UUID Generate UUID
```yaml ```yaml
tasks: tasks:
deploy: deploy:
@@ -765,7 +844,9 @@ tasks:
``` ```
#### `randIntN` #### `randIntN`
Generate random integer Generate random integer
```yaml ```yaml
tasks: tasks:
test: test:
@@ -865,19 +946,19 @@ vars:
PLATFORMS: PLATFORMS:
- os: linux - os: linux
arch: amd64 arch: amd64
cgo: "1" cgo: '1'
- os: linux - os: linux
arch: arm64 arch: arm64
cgo: "0" cgo: '0'
- os: windows - os: windows
arch: amd64 arch: amd64
cgo: "1" cgo: '1'
- os: darwin - os: darwin
arch: amd64 arch: amd64
cgo: "1" cgo: '1'
- os: darwin - os: darwin
arch: arm64 arch: arm64
cgo: "0" cgo: '0'
tasks: tasks:
build-all: build-all:

View File

@@ -1,6 +1,8 @@
--- ---
title: Releasing title: Releasing
description: Task release process including GoReleaser, Homebrew, npm, Snapcraft, winget, and other package managers description:
Task release process including GoReleaser, Homebrew, npm, Snapcraft, winget,
and other package managers
outline: deep outline: deep
--- ---
@@ -67,5 +69,6 @@ If you think its Task version is outdated, open an issue to let us know.
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb [gotaskrb]: https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb
[packagejson]: https://github.com/go-task/task/blob/main/package.json#L3 [packagejson]: https://github.com/go-task/task/blob/main/package.json#L3
[snappackage]: https://github.com/go-task/snap [snappackage]: https://github.com/go-task/snap
[snapcraftyaml]: https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2 [snapcraftyaml]:
https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml#L2
[snapcraftdashboard]: https://snapcraft.io/task/releases [snapcraftdashboard]: https://snapcraft.io/task/releases

View File

@@ -1,6 +1,8 @@
--- ---
title: Style Guide title: Style Guide
description: Official style guide for Taskfile.yml files with best practices and recommended conventions description:
Official style guide for Taskfile.yml files with best practices and
recommended conventions
outline: deep outline: deep
--- ---

View File

@@ -1,6 +1,8 @@
--- ---
title: Taskfile Versions title: Taskfile Versions
description: How to use the Taskfile schema version to ensure users are using the correct versions of Task description:
How to use the Taskfile schema version to ensure users are using the correct
versions of Task
outline: deep outline: deep
--- ---

View File

@@ -35,11 +35,12 @@ the file tree until it finds one (similar to how `git` works). When running Task
from a subdirectory like this, it will behave as if you ran it from the from a subdirectory like this, it will behave as if you ran it from the
directory containing the Taskfile. directory containing the Taskfile.
You can use this functionality along with the special <span v-pre>`{{.USER_WORKING_DIR}}`</span> You can use this functionality along with the special
variable to create some very useful reusable tasks. For example, if you have a <span v-pre>`{{.USER_WORKING_DIR}}`</span> variable to create some very useful
monorepo with directories for each microservice, you can `cd` into a reusable tasks. For example, if you have a monorepo with directories for each
microservice directory and run a task command to bring it up without having to microservice, you can `cd` into a microservice directory and run a task command
create multiple tasks or Taskfiles with identical content. For example: to bring it up without having to create multiple tasks or Taskfiles with
identical content. For example:
```yaml ```yaml
version: '3' version: '3'
@@ -70,9 +71,9 @@ This is useful to have automation that you can run from anywhere in your system!
When running your global Taskfile with `-g`, tasks will run on `$HOME` by When running your global Taskfile with `-g`, tasks will run on `$HOME` by
default, and not on your working directory! default, and not on your working directory!
As mentioned in the previous section, the <span v-pre>`{{.USER_WORKING_DIR}}`</span> special As mentioned in the previous section, the
variable can be very handy here to run stuff on the directory you're calling <span v-pre>`{{.USER_WORKING_DIR}}`</span> special variable can be very handy
`task -g` from. here to run stuff on the directory you're calling `task -g` from.
```yaml ```yaml
version: '3' version: '3'
@@ -159,7 +160,6 @@ ENDPOINT=testing.com
::: :::
```yaml ```yaml
version: '3' version: '3'
@@ -306,8 +306,9 @@ includes:
### Flatten includes ### Flatten includes
You can flatten the included Taskfile tasks into the main Taskfile by using the `flatten` option. You can flatten the included Taskfile tasks into the main Taskfile by using the
It means that the included Taskfile tasks will be available without the namespace. `flatten` option. It means that the included Taskfile tasks will be available
without the namespace.
::: code-group ::: code-group
@@ -347,7 +348,8 @@ task: Available tasks for this project:
You can run `task foo` directly without the namespace. You can run `task foo` directly without the namespace.
You can also reference the task in other tasks without the namespace. So if you run `task greet` it will run `greet` and `foo` tasks and the output will be : You can also reference the task in other tasks without the namespace. So if you
run `task greet` it will run `greet` and `foo` tasks and the output will be :
```text ```text
Greet Greet
@@ -384,18 +386,21 @@ tasks:
::: :::
If you run `task -a` it will print: If you run `task -a` it will print:
```text ```text
task: Found multiple tasks (greet) included by "lib" task: Found multiple tasks (greet) included by "lib"
``` ```
If the included Taskfile has a task with the same name as a task in the main Taskfile, If the included Taskfile has a task with the same name as a task in the main
you may want to exclude it from the flattened tasks. Taskfile, you may want to exclude it from the flattened tasks.
You can do this by using the [`excludes` option](#exclude-tasks-from-being-included). You can do this by using the
[`excludes` option](#exclude-tasks-from-being-included).
### Exclude tasks from being included ### Exclude tasks from being included
You can exclude tasks from being included by using the `excludes` option. This option takes the list of tasks to be excluded from this include. You can exclude tasks from being included by using the `excludes` option. This
option takes the list of tasks to be excluded from this include.
::: code-group ::: code-group
@@ -417,7 +422,8 @@ tasks:
::: :::
`task included:foo` will throw an error because the `foo` task is excluded but `task included:bar` will work and display `Bar`. `task included:foo` will throw an error because the `foo` task is excluded but
`task included:bar` will work and display `Bar`.
It's compatible with the `flatten` option. It's compatible with the `flatten` option.
@@ -880,12 +886,14 @@ tasks that generate remote artifacts (Docker images, deploys, CD releases) the
checksum source and timestamps require either access to the artifact or for an checksum source and timestamps require either access to the artifact or for an
out-of-band refresh of the `.checksum` fingerprint file. out-of-band refresh of the `.checksum` fingerprint file.
Two special variables <span v-pre>`{{.CHECKSUM}}`</span> and <span v-pre>`{{.TIMESTAMP}}`</span> are available for Two special variables <span v-pre>`{{.CHECKSUM}}`</span> and
interpolation within `cmds` and `status` commands, depending on the method assigned to <span v-pre>`{{.TIMESTAMP}}`</span> are available for interpolation within
fingerprint the sources. Only `source` globs are fingerprinted. `cmds` and `status` commands, depending on the method assigned to fingerprint
the sources. Only `source` globs are fingerprinted.
Note that the <span v-pre>`{{.TIMESTAMP}}`</span> variable is a "live" Go `time.Time` struct, and Note that the <span v-pre>`{{.TIMESTAMP}}`</span> variable is a "live" Go
can be formatted using any of the methods that `time.Time` responds to. `time.Time` struct, and can be formatted using any of the methods that
`time.Time` responds to.
See [the Go Time documentation](https://golang.org/pkg/time/) for more See [the Go Time documentation](https://golang.org/pkg/time/) for more
information. information.
@@ -893,8 +901,9 @@ information.
You can use `--force` or `-f` if you want to force a task to run even when You can use `--force` or `-f` if you want to force a task to run even when
up-to-date. up-to-date.
Also, `task --status [tasks]...` will exit with a non-zero [exit Also, `task --status [tasks]...` will exit with a non-zero
code](/reference/cli.md#exit-codes) if any of the tasks are not up-to-date. [exit code](/reference/cli.md#exit-codes) if any of the tasks are not
up-to-date.
`status` can be combined with the `status` can be combined with the
[fingerprinting](#by-fingerprinting-locally-generated-files-and-their-sources) [fingerprinting](#by-fingerprinting-locally-generated-files-and-their-sources)
@@ -1057,11 +1066,16 @@ tasks:
### Ensuring required variables have allowed values ### Ensuring required variables have allowed values
If you want to ensure that a variable is set to one of a predefined set of valid values before executing a task, you can use requires. If you want to ensure that a variable is set to one of a predefined set of valid
This is particularly useful when there are strict requirements for what values a variable can take, and you want to provide clear feedback to the user when an invalid value is detected. values before executing a task, you can use requires. This is particularly
useful when there are strict requirements for what values a variable can take,
and you want to provide clear feedback to the user when an invalid value is
detected.
To use `requires`, you specify an array of allowed values in the vars sub-section under requires. Task will check if the variable is set to one of the allowed values. To use `requires`, you specify an array of allowed values in the vars
If the variable does not match any of these values, the task will raise an error and stop execution. sub-section under requires. Task will check if the variable is set to one of the
allowed values. If the variable does not match any of these values, the task
will raise an error and stop execution.
This check applies both to user-defined variables and environment variables. This check applies both to user-defined variables and environment variables.
@@ -1119,7 +1133,7 @@ tasks:
FLOAT: 3.14 FLOAT: 3.14
ARRAY: [1, 2, 3] ARRAY: [1, 2, 3]
MAP: MAP:
map: {A: 1, B: 2, C: 3} map: { A: 1, B: 2, C: 3 }
cmds: cmds:
- 'echo {{.STRING}}' # Hello, World! - 'echo {{.STRING}}' # Hello, World!
- 'echo {{.BOOL}}' # true - 'echo {{.BOOL}}' # true
@@ -1199,7 +1213,7 @@ version: '3'
tasks: tasks:
greet_user: greet_user:
desc: "Greet the user with a name." desc: 'Greet the user with a name.'
vars: vars:
USER_NAME: '{{.USER_NAME| default "DefaultUser"}}' USER_NAME: '{{.USER_NAME| default "DefaultUser"}}'
cmds: cmds:
@@ -1237,10 +1251,10 @@ This works for all types of variables.
### Referencing other variables ### Referencing other variables
Templating is great for referencing string values if you want to pass Templating is great for referencing string values if you want to pass a value
a value from one task to another. However, the templating engine is only able to from one task to another. However, the templating engine is only able to output
output strings. If you want to pass something other than a string to another strings. If you want to pass something other than a string to another task then
task then you will need to use a reference (`ref`) instead. you will need to use a reference (`ref`) instead.
::: code-group ::: code-group
@@ -1279,8 +1293,8 @@ tasks:
::: :::
This also works the same way when calling `deps` and when defining This also works the same way when calling `deps` and when defining a variable
a variable and can be used in any combination: and can be used in any combination:
```yaml ```yaml
version: 3 version: 3
@@ -1337,7 +1351,7 @@ tasks:
vars: vars:
JSON: '{"a": 1, "b": 2, "c": 3}' JSON: '{"a": 1, "b": 2, "c": 3}'
FOO: FOO:
ref: "fromJson .JSON" ref: 'fromJson .JSON'
cmds: cmds:
- echo {{.FOO}} - echo {{.FOO}}
``` ```
@@ -1382,9 +1396,11 @@ tasks:
cmds: cmds:
- for: - for:
matrix: matrix:
OS: ["windows", "linux", "darwin"] OS: ['windows', 'linux', 'darwin']
ARCH: ["amd64", "arm64"] ARCH: ['amd64', 'arm64']
cmd: echo "<span v-pre>{{.ITEM.OS}}</span>/<span v-pre>{{.ITEM.ARCH}}</span>" cmd:
echo "<span v-pre>{{.ITEM.OS}}</span>/<span
v-pre>{{.ITEM.ARCH}}</span>"
``` ```
This will output: This will output:
@@ -1401,11 +1417,11 @@ darwin/arm64
You can also use references to other variables as long as they are also lists: You can also use references to other variables as long as they are also lists:
```yaml ```yaml
version: "3" version: '3'
vars: vars:
OS_VAR: ["windows", "linux", "darwin"] OS_VAR: ['windows', 'linux', 'darwin']
ARCH_VAR: ["amd64", "arm64"] ARCH_VAR: ['amd64', 'arm64']
tasks: tasks:
default: default:
@@ -1416,7 +1432,9 @@ tasks:
ref: .OS_VAR ref: .OS_VAR
ARCH: ARCH:
ref: .ARCH_VAR ref: .ARCH_VAR
cmd: echo "<span v-pre>{{.ITEM.OS}}</span>/<span v-pre>{{.ITEM.ARCH}}</span>" cmd:
echo "<span v-pre>{{.ITEM.OS}}</span>/<span
v-pre>{{.ITEM.ARCH}}</span>"
``` ```
### Looping over your task's sources or generated files ### Looping over your task's sources or generated files
@@ -1460,9 +1478,9 @@ files that match that glob.
Paths will always be returned as paths relative to the task directory. If you 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` need to convert this to an absolute path, you can use the built-in `joinPath`
function. There are some [special function. There are some
variables](/reference/templating#special-variables) that you may find useful [special variables](/reference/templating#special-variables) that you may find
for this. useful for this.
::: code-group ::: code-group
@@ -1548,9 +1566,9 @@ tasks:
cmd: echo <span v-pre>{{.ITEM}}</span> cmd: echo <span v-pre>{{.ITEM}}</span>
``` ```
When looping over a map we also make an additional <span v-pre>`{{.KEY}}`</span> variable available When looping over a map we also make an additional <span v-pre>`{{.KEY}}`</span>
that holds the string value of the map key. Remember that maps are unordered, so variable available that holds the string value of the map key. Remember that
the order in which the items are looped over is random. maps are unordered, so the order in which the items are looped over is random.
All of this also works with dynamic variables! All of this also works with dynamic variables!
@@ -1701,14 +1719,15 @@ version: '3'
tasks: tasks:
start:*:*: start:*:*:
vars: vars:
SERVICE: "<span v-pre>{{index .MATCH 0}}</span>" SERVICE: '<span v-pre>{{index .MATCH 0}}</span>'
REPLICAS: "<span v-pre>{{index .MATCH 1}}</span>" REPLICAS: '<span v-pre>{{index .MATCH 1}}</span>'
cmds: cmds:
- echo "Starting <span v-pre>{{.SERVICE}}</span> with <span v-pre>{{.REPLICAS}}</span> replicas" - echo "Starting <span v-pre>{{.SERVICE}}</span> with <span
v-pre>{{.REPLICAS}}</span> replicas"
start:*: start:*:
vars: vars:
SERVICE: "<span v-pre>{{index .MATCH 0}}</span>" SERVICE: '<span v-pre>{{index .MATCH 0}}</span>'
cmds: cmds:
- echo "Starting <span v-pre>{{.SERVICE}}</span>" - echo "Starting <span v-pre>{{.SERVICE}}</span>"
``` ```
@@ -1792,7 +1811,10 @@ version: '3'
tasks: tasks:
default: default:
cmds: cmds:
- defer: echo '<span v-pre>{{if .EXIT_CODE}}</span>Failed with <span v-pre>{{.EXIT_CODE}}</span>!<span v-pre>{{else}}</span>Success!<span v-pre>{{end}}</span>' - defer:
echo '<span v-pre>{{if .EXIT_CODE}}</span>Failed with <span
v-pre>{{.EXIT_CODE}}</span>!<span v-pre>{{else}}</span>Success!<span
v-pre>{{end}}</span>'
- exit 1 - exit 1
``` ```
@@ -2322,9 +2344,9 @@ which files to watch.
The default watch interval is 100 milliseconds, but it's possible to change it The default watch interval is 100 milliseconds, but it's possible to change it
by either setting `interval: '500ms'` in the root of the Taskfile or by passing by either setting `interval: '500ms'` in the root of the Taskfile or by passing
it as an argument like `--interval=500ms`. it as an argument like `--interval=500ms`. This interval is the time Task will
This interval is the time Task will wait for duplicated events. It will only run wait for duplicated events. It will only run the task again once, even if
the task again once, even if multiple changes happen within the interval. multiple changes happen within the interval.
Also, it's possible to set `watch: true` in a given task and it'll automatically Also, it's possible to set `watch: true` in a given task and it'll automatically
run in watch mode: run in watch mode:
@@ -2355,10 +2377,9 @@ if called by another task, either directly or as a dependency.
::: warning ::: warning
The watcher can misbehave in certain scenarios, in particular for long-running The watcher can misbehave in certain scenarios, in particular for long-running
servers. servers. There is a known bug where child processes of the running might not be
There is a known bug where child processes of the running might not be killed killed appropriately. It's advised to avoid running commands as `go run` and
appropriately. It's advised to avoid running commands as `go run` and prefer prefer `go build [...] && ./binary` instead.
`go build [...] && ./binary` instead.
If you are having issues, you might want to try tools specifically designed for If you are having issues, you might want to try tools specifically designed for
live-reloading, like [Air](https://github.com/air-verse/air/). Also, be sure to live-reloading, like [Air](https://github.com/air-verse/air/). Also, be sure to

View File

@@ -8,23 +8,24 @@ outline: false
If you find this project useful, consider supporting its ongoing development. If you find this project useful, consider supporting its ongoing development.
> This is just a way to say **“thank you”** — donations won’t provide priority support or special privileges. > This is just a way to say **“thank you”** — donations won’t provide priority
> support or special privileges.
## 🏆 Gold Sponsorship ## 🏆 Gold Sponsorship
Companies donating **$50/month or more** can become a **Gold Sponsor**, featured on: Companies donating **$50/month or more** can become a **Gold Sponsor**, featured
on:
- The website homepage - The website homepage
- The GitHub repository README - The GitHub repository README
> 💬 To be featured, contact [@andreynering] with your logo. > 💬 To be featured, contact [@andreynering] with your logo. ⚠️ Suspicious or
> ⚠️ Suspicious or inappropriate businesses (e.g. gambling, casinos) will be rejected. > inappropriate businesses (e.g. gambling, casinos) will be rejected.
## ❤️ GitHub Sponsors _(recommended)_
## ❤️ GitHub Sponsors *(recommended)* The preferred way to donate is through **GitHub Sponsors**. We suggest splitting
your donation equally between maintainers:
The preferred way to donate is through **GitHub Sponsors**.
We suggest splitting your donation equally between maintainers:
<div style="display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0;"> <div style="display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0;">
<a href="https://github.com/sponsors/andreynering" target="_blank"> <a href="https://github.com/sponsors/andreynering" target="_blank">
@@ -38,7 +39,6 @@ We suggest splitting your donation equally between maintainers:
</a> </a>
</div> </div>
## 🌐 Open Collective ## 🌐 Open Collective
Prefer **Open Collective**? Choose a tier: Prefer **Open Collective**? Choose a tier:
@@ -49,19 +49,16 @@ Prefer **Open Collective**? Choose a tier:
- [$50/month](https://opencollective.com/task/contribute/sponsor-28775/checkout) - [$50/month](https://opencollective.com/task/contribute/sponsor-28775/checkout)
- [🎯 Custom / One-time](https://opencollective.com/task/donate) - [🎯 Custom / One-time](https://opencollective.com/task/donate)
## 💳 PayPal ## 💳 PayPal
You can also make a **one-time donation** to @andreynering via PayPal: You can also make a **one-time donation** to @andreynering via PayPal:
[Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A&currency_code=USD&source=url) [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A&currency_code=USD&source=url)
## 🇧🇷 PIX (Brazil only) ## 🇧🇷 PIX (Brazil only)
If you're in Brazil, you can also support @andreynering via PIX: If you're in Brazil, you can also support @andreynering via PIX:
<img src="/img/pix.png" width="200" height="200" alt="PIX QR Code" /> <img src="/img/pix.png" width="200" height="200" alt="PIX QR Code" />
Thank you for helping Taskfile grow and stay maintained! 💚 Thank you for helping Taskfile grow and stay maintained! 💚

View File

@@ -3,7 +3,9 @@ layout: home
hero: hero:
name: Task name: Task
text: The Modern Task Runner text: The Modern Task Runner
tagline: A fast, cross-platform build tool inspired by Make, designed for modern workflows. tagline:
A fast, cross-platform build tool inspired by Make, designed for modern
workflows.
image: image:
src: /img/logo.png src: /img/logo.png
alt: Task logo alt: Task logo
@@ -18,22 +20,29 @@ hero:
text: CLI text: CLI
link: /reference/cli link: /reference/cli
features: features:
- title: 30-Second Setup - title: 30-Second Setup
details: Single binary download, zero dependencies. Works with Homebrew, Snapcraft, Scoop and more. details:
Single binary download, zero dependencies. Works with Homebrew, Snapcraft,
Scoop and more.
icon: 🚀 icon: 🚀
- title: Truly cross-platform - title: Truly cross-platform
icon: 🖥️ icon: 🖥️
details: Run the same Taskfile on Linux, macOS and Windows. No extra setup. Task handles platform quirks so you don’t have to. details:
Run the same Taskfile on Linux, macOS and Windows. No extra setup. Task
handles platform quirks so you don’t have to.
- title: Smart Caching - title: Smart Caching
icon: 🎯 icon: 🎯
details: Skip unnecessary rebuilds by tracking file changes (timestamp or content-based). details:
Skip unnecessary rebuilds by tracking file changes (timestamp or
content-based).
- title: Ideal for code generation & scaffolding - title: Ideal for code generation & scaffolding
icon: ⚡ icon: ⚡
details: Use Task to wire up codegen tools, formatters, linters, or anything repetitive. Chain commands, set dependencies, and keep your workflow clean. details:
Use Task to wire up codegen tools, formatters, linters, or anything
repetitive. Chain commands, set dependencies, and keep your workflow
clean.
--- ---

View File

@@ -276,7 +276,14 @@
"^.*$": { "^.*$": {
"anyOf": [ "anyOf": [
{ {
"type": ["boolean", "integer", "null", "number", "string", "array"] "type": [
"boolean",
"integer",
"null",
"number",
"string",
"array"
]
}, },
{ {
"$ref": "#/definitions/var_subkey" "$ref": "#/definitions/var_subkey"
@@ -416,10 +423,7 @@
"$ref": "#/definitions/platforms" "$ref": "#/definitions/platforms"
} }
}, },
"oneOf": [ "oneOf": [{ "required": ["cmd"] }, { "required": ["task"] }],
{"required": ["cmd"]},
{"required": ["task"]}
],
"additionalProperties": false, "additionalProperties": false,
"required": ["for"] "required": ["for"]
}, },
@@ -442,10 +446,7 @@
"$ref": "#/definitions/vars" "$ref": "#/definitions/vars"
} }
}, },
"oneOf": [ "oneOf": [{ "required": ["cmd"] }, { "required": ["task"] }],
{"required": ["cmd"]},
{"required": ["task"]}
],
"additionalProperties": false, "additionalProperties": false,
"required": ["for"] "required": ["for"]
}, },
@@ -592,8 +593,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "type": "string" }, "name": { "type": "string" },
"enum": { "type": "array", "enum": { "type": "array", "items": { "type": "string" } }
"items": { "type": "string" } }
}, },
"required": ["name", "enum"], "required": ["name", "enum"],
"additionalProperties": false "additionalProperties": false

View File

@@ -1,6 +1,7 @@
--- ---
layout: page layout: page
--- ---
<script setup> <script setup>
import { import {
VPTeamPage, VPTeamPage,

View File

@@ -16,11 +16,6 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true
}, },
"include": [ "include": [".vitepress/**/*", "**/*.vue", "**/*.ts", "**/*.tsx"],
".vitepress/**/*",
"**/*.vue",
"**/*.ts",
"**/*.tsx"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }