mirror of
https://github.com/go-task/task.git
synced 2026-06-16 20:31:39 +00:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea98467c0 | ||
|
|
4e6ec14223 | ||
|
|
d6b7d532ed | ||
|
|
46f7bba90d | ||
|
|
02f1c8482a | ||
|
|
4de2ccea59 | ||
|
|
0bf5fab9c0 | ||
|
|
e97c48051e | ||
|
|
307f39cee3 | ||
|
|
f346015d8c | ||
|
|
a2f8adbb5c | ||
|
|
82510a04af | ||
|
|
5eda349bbd | ||
|
|
8d99c33472 | ||
|
|
5fdaa9aa36 | ||
|
|
d8a12fe56d | ||
|
|
c79378f380 | ||
|
|
5e78171d3e | ||
|
|
d82b0faca1 | ||
|
|
26f3fb157f | ||
|
|
7c66bcc857 | ||
|
|
1dd5d7ad1a | ||
|
|
667835f2a0 | ||
|
|
427e0cd46d | ||
|
|
92aa4927db | ||
|
|
5c68f87114 | ||
|
|
ede8da7677 | ||
|
|
b44231a6b8 |
37
.github/workflows/website-deploy.yml
vendored
37
.github/workflows/website-deploy.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: Website Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
website-deploy:
|
||||
name: Website Deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
cache-dependency-path: ./docs/yarn.lock
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ./docs
|
||||
|
||||
- name: Build website
|
||||
run: yarn build
|
||||
working-directory: ./docs
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Website Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GH_PAT }}
|
||||
publish_dir: ./docs/build
|
||||
user_name: task-bot
|
||||
user_email: 106601941+task-bot@users.noreply.github.com
|
||||
29
.github/workflows/website-test.yml
vendored
29
.github/workflows/website-test.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Website Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
website-test:
|
||||
name: Website Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
cache-dependency-path: ./docs/yarn.lock
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ./docs
|
||||
|
||||
- name: Test build website
|
||||
run: yarn build
|
||||
working-directory: ./docs
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
26
CHANGELOG.md
26
CHANGELOG.md
@@ -1,6 +1,26 @@
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 = 2023-06-10
|
||||
## v3.27.1 - 2023-06-30
|
||||
|
||||
- Fix panic when a `.env` directory (not file) is present on current directory
|
||||
(#1244, #1245 by @pd93).
|
||||
|
||||
## v3.27.0 - 2023-06-29
|
||||
|
||||
- Allow Taskfiles starting with lowercase characters (#947, #1221 by @pd93).
|
||||
- e.g. `taskfile.yml`, `taskfile.yaml`, `taskfile.dist.yml` &
|
||||
`taskfile.dist.yaml`
|
||||
- Bug fixes were made to the
|
||||
[npm installation method](https://taskfile.dev/installation/#npm). (#1190, by
|
||||
@sounisi5011).
|
||||
- Added the [gentle force experiment](https://taskfile.dev/experiments) as a
|
||||
draft (#1200, #1216 by @pd93).
|
||||
- Added an `--experiments` flag to allow you to see which experiments are
|
||||
enabled (#1242 by @pd93).
|
||||
- Added ability to specify which variables are required in a task (#1203, #1204
|
||||
by @benc-uk).
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed (#1185,
|
||||
#1194 by @deviantintegral).
|
||||
@@ -13,8 +33,8 @@
|
||||
[Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now
|
||||
possible to declare just `cmd:` in a task, avoiding the more complex
|
||||
`cmds: []` when you have only a single command for that task
|
||||
(#1130, #1131 by @timdp).
|
||||
`cmds: []` when you have only a single command for that task (#1130, #1131 by
|
||||
@timdp).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ func ParseV3(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
|
||||
for _, arg := range args {
|
||||
if !strings.Contains(arg, "=") {
|
||||
calls = append(calls, taskfile.Call{Task: arg})
|
||||
calls = append(calls, taskfile.Call{Task: arg, Direct: true})
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func ParseV3(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
}
|
||||
|
||||
if len(calls) == 0 {
|
||||
calls = append(calls, taskfile.Call{Task: "default"})
|
||||
calls = append(calls, taskfile.Call{Task: "default", Direct: true})
|
||||
}
|
||||
|
||||
return calls, globals
|
||||
@@ -35,7 +35,7 @@ func ParseV2(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
|
||||
for _, arg := range args {
|
||||
if !strings.Contains(arg, "=") {
|
||||
calls = append(calls, taskfile.Call{Task: arg})
|
||||
calls = append(calls, taskfile.Call{Task: arg, Direct: true})
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func ParseV2(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
}
|
||||
|
||||
if len(calls) == 0 {
|
||||
calls = append(calls, taskfile.Call{Task: "default"})
|
||||
calls = append(calls, taskfile.Call{Task: "default", Direct: true})
|
||||
}
|
||||
|
||||
return calls, globals
|
||||
|
||||
@@ -20,17 +20,17 @@ func TestArgsV3(t *testing.T) {
|
||||
{
|
||||
Args: []string{"task-a", "task-b", "task-c"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
{Task: "task-a", Direct: true},
|
||||
{Task: "task-b", Direct: true},
|
||||
{Task: "task-c", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "FOO=bar", "task-b", "task-c", "BAR=baz", "BAZ=foo"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
{Task: "task-a", Direct: true},
|
||||
{Task: "task-b", Direct: true},
|
||||
{Task: "task-c", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
@@ -46,7 +46,7 @@ func TestArgsV3(t *testing.T) {
|
||||
{
|
||||
Args: []string{"task-a", "CONTENT=with some spaces"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-a", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
@@ -60,8 +60,8 @@ func TestArgsV3(t *testing.T) {
|
||||
{
|
||||
Args: []string{"FOO=bar", "task-a", "task-b"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-a", Direct: true},
|
||||
{Task: "task-b", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
@@ -75,19 +75,19 @@ func TestArgsV3(t *testing.T) {
|
||||
{
|
||||
Args: nil,
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "BAR=baz"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
@@ -122,16 +122,17 @@ func TestArgsV2(t *testing.T) {
|
||||
{
|
||||
Args: []string{"task-a", "task-b", "task-c"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
{Task: "task-a", Direct: true},
|
||||
{Task: "task-b", Direct: true},
|
||||
{Task: "task-c", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "FOO=bar", "task-b", "task-c", "BAR=baz", "BAZ=foo"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{
|
||||
Task: "task-a",
|
||||
Task: "task-a",
|
||||
Direct: true,
|
||||
Vars: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
map[string]taskfile.Var{
|
||||
@@ -141,9 +142,10 @@ func TestArgsV2(t *testing.T) {
|
||||
),
|
||||
},
|
||||
},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-b", Direct: true},
|
||||
{
|
||||
Task: "task-c",
|
||||
Task: "task-c",
|
||||
Direct: true,
|
||||
Vars: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
map[string]taskfile.Var{
|
||||
@@ -160,7 +162,8 @@ func TestArgsV2(t *testing.T) {
|
||||
Args: []string{"task-a", "CONTENT=with some spaces"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{
|
||||
Task: "task-a",
|
||||
Task: "task-a",
|
||||
Direct: true,
|
||||
Vars: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
map[string]taskfile.Var{
|
||||
@@ -175,8 +178,8 @@ func TestArgsV2(t *testing.T) {
|
||||
{
|
||||
Args: []string{"FOO=bar", "task-a", "task-b"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-a", Direct: true},
|
||||
{Task: "task-b", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
@@ -190,19 +193,19 @@ func TestArgsV2(t *testing.T) {
|
||||
{
|
||||
Args: nil,
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "BAR=baz"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
{Task: "default", Direct: true},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
OrderedMap: orderedmap.FromMapWithOrder(
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/go-task/task/v3"
|
||||
"github.com/go-task/task/v3/args"
|
||||
"github.com/go-task/task/v3/errors"
|
||||
"github.com/go-task/task/v3/internal/experiments"
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
"github.com/go-task/task/v3/internal/sort"
|
||||
ver "github.com/go-task/task/v3/internal/version"
|
||||
@@ -53,6 +54,7 @@ var flags struct {
|
||||
taskSort string
|
||||
status bool
|
||||
force bool
|
||||
forceAll bool
|
||||
watch bool
|
||||
verbose bool
|
||||
silent bool
|
||||
@@ -68,6 +70,7 @@ var flags struct {
|
||||
color bool
|
||||
interval time.Duration
|
||||
global bool
|
||||
experiments bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -78,7 +81,6 @@ func main() {
|
||||
Verbose: flags.verbose,
|
||||
Color: flags.color,
|
||||
}
|
||||
|
||||
if err, ok := err.(*errors.TaskRunError); ok && flags.exitCode {
|
||||
l.Errf(logger.Red, "%v\n", err)
|
||||
os.Exit(err.TaskExitCode())
|
||||
@@ -110,7 +112,6 @@ func run() error {
|
||||
pflag.BoolVarP(&flags.listJson, "json", "j", false, "Formats task list as JSON.")
|
||||
pflag.StringVar(&flags.taskSort, "sort", "", "Changes the order of the tasks when listed. [default|alphanumeric|none].")
|
||||
pflag.BoolVar(&flags.status, "status", false, "Exits with non-zero exit code if any of the given tasks is not up-to-date.")
|
||||
pflag.BoolVarP(&flags.force, "force", "f", false, "Forces execution even when the task is up-to-date.")
|
||||
pflag.BoolVarP(&flags.watch, "watch", "w", false, "Enables watch of the given task.")
|
||||
pflag.BoolVarP(&flags.verbose, "verbose", "v", false, "Enables verbose mode.")
|
||||
pflag.BoolVarP(&flags.silent, "silent", "s", false, "Disables echoing.")
|
||||
@@ -128,7 +129,17 @@ func run() error {
|
||||
pflag.BoolVarP(&flags.color, "color", "c", true, "Colored output. Enabled by default. Set flag to false or use NO_COLOR=1 to disable.")
|
||||
pflag.IntVarP(&flags.concurrency, "concurrency", "C", 0, "Limit number tasks to run concurrently.")
|
||||
pflag.DurationVarP(&flags.interval, "interval", "I", 0, "Interval to watch for changes.")
|
||||
pflag.BoolVarP(&flags.global, "global", "g", false, "Runs global Taskfile, from $HOME/Taskfile.{yml,yaml}.")
|
||||
pflag.BoolVarP(&flags.global, "global", "g", false, "Runs global Taskfile, from $HOME/{T,t}askfile.{yml,yaml}.")
|
||||
pflag.BoolVar(&flags.experiments, "experiments", false, "Lists all the available experiments and whether or not they are enabled.")
|
||||
|
||||
// Gentle force experiment will override the force flag and add a new force-all flag
|
||||
if experiments.GentleForce {
|
||||
pflag.BoolVarP(&flags.force, "force", "f", false, "Forces execution of the directly called task.")
|
||||
pflag.BoolVar(&flags.forceAll, "force-all", false, "Forces execution of the called task and all its dependant tasks.")
|
||||
} else {
|
||||
pflag.BoolVarP(&flags.forceAll, "force", "f", false, "Forces execution even when the task is up-to-date.")
|
||||
}
|
||||
|
||||
pflag.Parse()
|
||||
|
||||
if flags.version {
|
||||
@@ -141,6 +152,16 @@ func run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if flags.experiments {
|
||||
l := &logger.Logger{
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
Verbose: flags.verbose,
|
||||
Color: flags.color,
|
||||
}
|
||||
return experiments.List(l)
|
||||
}
|
||||
|
||||
if flags.init {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
@@ -194,6 +215,7 @@ func run() error {
|
||||
|
||||
e := task.Executor{
|
||||
Force: flags.force,
|
||||
ForceAll: flags.forceAll,
|
||||
Watch: flags.watch,
|
||||
Verbose: flags.verbose,
|
||||
Silent: flags.silent,
|
||||
|
||||
@@ -76,6 +76,7 @@ A full list of the exit codes and their descriptions can be found below:
|
||||
| 203 | There a multiple tasks with the same name or alias |
|
||||
| 204 | A task was called too many times |
|
||||
| 205 | A task was cancelled by the user |
|
||||
| 206 | A task was not executed due to missing required variables |
|
||||
|
||||
These codes can also be found in the repository in
|
||||
[`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
|
||||
@@ -219,7 +220,9 @@ vars:
|
||||
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
|
||||
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
|
||||
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
|
||||
| `requires` | `[]string` | | A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run. |
|
||||
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
|
||||
| `requires` | [`Requires`](#requires) | | A list of required variables which should be set if this task is to run, if any variables listed are unset the task will error and not run. |
|
||||
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
|
||||
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
|
||||
@@ -322,3 +325,9 @@ tasks:
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
#### Requires
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| --------- | ---------- | ------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `vars` | `[]string` | | List of variable or environment variable names that must be set if this task is to execute and run |
|
||||
|
||||
@@ -5,7 +5,27 @@ sidebar_position: 9
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 = 2023-06-10
|
||||
## v3.27.1 - 2023-06-30
|
||||
|
||||
- Fix panic when a `.env` directory (not file) is present on current directory
|
||||
([#1244](https://github.com/go-task/task/issues/1244), [#1245](https://github.com/go-task/task/issues/1245) by [@pd93](https://github.com/pd93)).
|
||||
|
||||
## v3.27.0 - 2023-06-29
|
||||
|
||||
- Allow Taskfiles starting with lowercase characters ([#947](https://github.com/go-task/task/issues/947), [#1221](https://github.com/go-task/task/issues/1221) by [@pd93](https://github.com/pd93)).
|
||||
- e.g. `taskfile.yml`, `taskfile.yaml`, `taskfile.dist.yml` &
|
||||
`taskfile.dist.yaml`
|
||||
- Bug fixes were made to the
|
||||
[npm installation method](https://taskfile.dev/installation/#npm). ([#1190](https://github.com/go-task/task/issues/1190), by
|
||||
[@sounisi5011](https://github.com/sounisi5011)).
|
||||
- Added the [gentle force experiment](https://taskfile.dev/experiments) as a
|
||||
draft ([#1200](https://github.com/go-task/task/issues/1200), [#1216](https://github.com/go-task/task/issues/1216) by [@pd93](https://github.com/pd93)).
|
||||
- Added an `--experiments` flag to allow you to see which experiments are
|
||||
enabled ([#1242](https://github.com/go-task/task/issues/1242) by [@pd93](https://github.com/pd93)).
|
||||
- Added ability to specify which variables are required in a task ([#1203](https://github.com/go-task/task/issues/1203), [#1204](https://github.com/go-task/task/issues/1204)
|
||||
by [@benc](https://github.com/benc)-uk).
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185),
|
||||
[#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
@@ -18,8 +38,8 @@ sidebar_position: 9
|
||||
[Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now
|
||||
possible to declare just `cmd:` in a task, avoiding the more complex
|
||||
`cmds: []` when you have only a single command for that task
|
||||
([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
`cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by
|
||||
[@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@ thankful for everyone that helps me to improve the overall experience.
|
||||
|
||||
## Translations
|
||||
|
||||
[@DeronW](https://github.com/DeronW) maintains the
|
||||
[Chinese translation](https://task-zh.readthedocs.io/zh_CN/latest/) of the
|
||||
website [on this repository](https://github.com/DeronW/task).
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## Integrations
|
||||
|
||||
@@ -32,6 +30,7 @@ Some installation methods are maintained by third party:
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## More
|
||||
|
||||
|
||||
@@ -21,13 +21,19 @@ are intended to replace.
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of
|
||||
Task to test out experimental features. You can also disable a feature by
|
||||
specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for
|
||||
permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For
|
||||
example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off
|
||||
invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`,
|
||||
`.zshrc` etc.). This is intended for permanently enabling experimental
|
||||
features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that
|
||||
contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -38,11 +44,11 @@ existing Taskfiles to the new behavior.
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -64,6 +70,27 @@ version 3 as soon as possible.
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3
|
||||
Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status
|
||||
checks. This can be useful, but we have found that most of the time users only
|
||||
expect the direct task they are calling to be forced and _not_ all of its
|
||||
dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called
|
||||
task. All dependant tasks will have their statuses checked as normal and will
|
||||
only run if Task considers them to be out of date. A new `--force-all` flag will
|
||||
also be added to maintain the current behavior for users that need this
|
||||
functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you
|
||||
should replace all uses of the `--force` flag with `--force-all`. Alternatively,
|
||||
if you want to adopt the new behavior, you can continue to use the `--force`
|
||||
flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[breaking-change-proposal]: https://github.com/go-task/task/discussions/1191
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
|
||||
@@ -43,9 +43,13 @@ If you omit a task name, "default" will be assumed.
|
||||
Task will look for the following file names, in order of priority:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
The intention of having the `.dist` variants is to allow projects to have one
|
||||
committed version (`.dist`) while still allowing individual users to override
|
||||
@@ -85,7 +89,7 @@ will be brought up.
|
||||
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your
|
||||
home directory instead of your working directory. In short, Task will look for a
|
||||
Taskfile on either `$HOME/Taskfile.yml` or `$HOME/Taskfile.yaml` paths.
|
||||
Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
@@ -872,6 +876,48 @@ tasks:
|
||||
- sleep 5 # long operation like installing packages
|
||||
```
|
||||
|
||||
### Ensuring required variables are set
|
||||
|
||||
If you want to check that certain variables are set before running a task then
|
||||
you can use `requires`. This is useful when might not be clear to users which
|
||||
variables are needed, or if you want clear message about what is required. Also
|
||||
some tasks could have dangerous side effects if run with un-set variables.
|
||||
|
||||
Using `requires` you specify an array of strings in the `vars` sub-section
|
||||
under `requires`, these strings are variable names which are checked prior to
|
||||
running the task. If any variables are un-set the the task will error and not
|
||||
run.
|
||||
|
||||
Environmental variables are also checked.
|
||||
|
||||
Syntax:
|
||||
|
||||
```yaml
|
||||
requires:
|
||||
vars: [] # Array of strings
|
||||
```
|
||||
|
||||
:::note
|
||||
|
||||
Variables set to empty zero length strings, will pass the `requires` check.
|
||||
|
||||
:::
|
||||
|
||||
Example of using `requires`:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
docker-build:
|
||||
cmds:
|
||||
- 'docker build . -t {{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
|
||||
|
||||
# Make sure these variables are set before running
|
||||
requires:
|
||||
vars: [IMAGE_NAME, IMAGE_TAG]
|
||||
```
|
||||
|
||||
## Variables
|
||||
|
||||
When doing interpolation of variables, Task will look for the below. They are
|
||||
|
||||
@@ -210,6 +210,13 @@ const getConfig = async () => {
|
||||
href: 'https://opencollective.com/task'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{
|
||||
html: '<a target="_blank" href="https://www.netlify.com"><img src="https://www.netlify.com/v3/img/components/netlify-color-accent.svg" alt="Deploys by Netlify" /></a>'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -5,6 +5,14 @@ sidebar_position: 9
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185), [#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
- Added [experiments documentation](https://taskfile.dev/experiments) to the website ([#1198](https://github.com/go-task/task/issues/1198) by [@pd93](https://github.com/pd93)).
|
||||
- Deprecated `version: 2` schema. This will be removed in the next major release ([#1197](https://github.com/go-task/task/issues/1197), [#1198](https://github.com/go-task/task/issues/1198), [#1199](https://github.com/go-task/task/issues/1199) by [@pd93](https://github.com/pd93)).
|
||||
- Added a new `prompt:` prop to set a warning prompt to be shown before running a potential dangurous task ([#100](https://github.com/go-task/task/issues/100), [#1163](https://github.com/go-task/task/issues/1163) by [@MaxCheetham](https://github.com/MaxCheetham), [Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now possible to declare just `cmd:` in a task, avoiding the more complex `cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
- Support `silent:` when calling another tasks ([#680](https://github.com/go-task/task/issues/680), [#1142](https://github.com/go-task/task/issues/1142) by [@danquah](https://github.com/danquah)).
|
||||
|
||||
@@ -9,7 +9,7 @@ Some of the work to improve the Task ecosystem is done by the community, be it i
|
||||
|
||||
## Translations
|
||||
|
||||
[@DeronW](https://github.com/DeronW) maintains the [Chinese translation](https://task-zh.readthedocs.io/zh_CN/latest/) of the website [on this repository](https://github.com/DeronW/task).
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## Integrations
|
||||
|
||||
@@ -24,6 +24,7 @@ Some installation methods are maintained by third party:
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## More
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ In order to allow Task to evolve quickly, we roll out breaking changes to minor
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of Task to test out experimental features. You can also disable a feature by specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -26,11 +30,11 @@ Each section below details an experiment or deprecation and explains what the fl
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -46,9 +50,21 @@ This notice does not mean that we are immediately removing support for version 2
|
||||
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3 Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment][] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status checks. This can be useful, but we have found that most of the time users only expect the direct task they are calling to be forced and _not_ all of its dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called task. All dependant tasks will have their statuses checked as normal and will only run if Task considers them to be out of date. A new `--force-all` flag will also be added to maintain the current behavior for users that need this functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you should replace all uses of the `--force` flag with `--force-all`. Alternatively, if you want to adopt the new behavior, you can continue to use the `--force` flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
[version-3-release-notes]: https://github.com/go-task/task/releases/tag/v3.0.0
|
||||
[deprecated]: https://img.shields.io/badge/deprecated-red
|
||||
[experiment]: https://img.shields.io/badge/experiment-yellow
|
||||
|
||||
@@ -37,9 +37,13 @@ If you omit a task name, "default" will be assumed.
|
||||
Task will look for the following file names, in order of priority:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
The intention of having the `.dist` variants is to allow projects to have one committed version (`.dist`) while still allowing individual users to override the Taskfile by adding an additional `Taskfile.yml` (which would be on `.gitignore`).
|
||||
|
||||
@@ -65,7 +69,7 @@ In this example, we can run `cd <service>` and `task up` and as long as the `<se
|
||||
|
||||
### Running a global Taskfile
|
||||
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile on either `$HOME/Taskfile.yml` or `$HOME/Taskfile.yaml` paths.
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ sidebar_position: 9
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185), [#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
- Added [experiments documentation](https://taskfile.dev/experiments) to the website ([#1198](https://github.com/go-task/task/issues/1198) by [@pd93](https://github.com/pd93)).
|
||||
- Deprecated `version: 2` schema. This will be removed in the next major release ([#1197](https://github.com/go-task/task/issues/1197), [#1198](https://github.com/go-task/task/issues/1198), [#1199](https://github.com/go-task/task/issues/1199) by [@pd93](https://github.com/pd93)).
|
||||
- Added a new `prompt:` prop to set a warning prompt to be shown before running a potential dangurous task ([#100](https://github.com/go-task/task/issues/100), [#1163](https://github.com/go-task/task/issues/1163) by [@MaxCheetham](https://github.com/MaxCheetham), [Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now possible to declare just `cmd:` in a task, avoiding the more complex `cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
- Support `silent:` when calling another tasks ([#680](https://github.com/go-task/task/issues/680), [#1142](https://github.com/go-task/task/issues/1142) by [@danquah](https://github.com/danquah)).
|
||||
|
||||
@@ -9,7 +9,7 @@ Certains travaux d'amélioration de l'écosystème Task sont réalisés par la c
|
||||
|
||||
## Traductions
|
||||
|
||||
[@DeronW](https://github.com/DeronW) maintient la [traduction Chinoise](https://task-zh.readthedocs.io/zh_CN/latest/) du site [sur ce dépôt](https://github.com/DeronW/task).
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## Intégrations
|
||||
|
||||
@@ -24,6 +24,7 @@ Certaines méthodes d'installation sont maintenues par un tiers :
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## Plus d’infos
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ In order to allow Task to evolve quickly, we roll out breaking changes to minor
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of Task to test out experimental features. You can also disable a feature by specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -26,11 +30,11 @@ Each section below details an experiment or deprecation and explains what the fl
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -46,9 +50,21 @@ This notice does not mean that we are immediately removing support for version 2
|
||||
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3 Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment][] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status checks. This can be useful, but we have found that most of the time users only expect the direct task they are calling to be forced and _not_ all of its dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called task. All dependant tasks will have their statuses checked as normal and will only run if Task considers them to be out of date. A new `--force-all` flag will also be added to maintain the current behavior for users that need this functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you should replace all uses of the `--force` flag with `--force-all`. Alternatively, if you want to adopt the new behavior, you can continue to use the `--force` flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
[version-3-release-notes]: https://github.com/go-task/task/releases/tag/v3.0.0
|
||||
[deprecated]: https://img.shields.io/badge/deprecated-red
|
||||
[experiment]: https://img.shields.io/badge/experiment-yellow
|
||||
|
||||
@@ -37,9 +37,13 @@ If you omit a task name, "default" will be assumed.
|
||||
Task will look for the following file names, in order of priority:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
The intention of having the `.dist` variants is to allow projects to have one committed version (`.dist`) while still allowing individual users to override the Taskfile by adding an additional `Taskfile.yml` (which would be on `.gitignore`).
|
||||
|
||||
@@ -65,7 +69,7 @@ In this example, we can run `cd <service>` and `task up` and as long as the `<se
|
||||
|
||||
### Running a global Taskfile
|
||||
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile on either `$HOME/Taskfile.yml` or `$HOME/Taskfile.yaml` paths.
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ toc_max_heading_level: 5
|
||||
|
||||
# Referência da API
|
||||
|
||||
## CLI
|
||||
## Linha de comando
|
||||
|
||||
O comando "task" tem a seguinte sintaxe:
|
||||
|
||||
@@ -21,39 +21,39 @@ Se `--` é informado, todos os argumentos remanescentes serão atribuídos a uma
|
||||
|
||||
:::
|
||||
|
||||
| Abreviação | Modificador | Tipo | Predefinição | Descrição |
|
||||
| ---------- | --------------------------- | -------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | Saída colorida. Habilitado por padrão. Defina o modificador como `false` ou use `NO_COLOR=1` para desativar. |
|
||||
| `-C` | `--concurrency` | `int` | `0` | Limitar número de tarefas a serem executadas simultaneamente. Zero significa ilimitado. |
|
||||
| `-d` | `--dir` | `string` | Pasta atual | Define a pasta de execução. |
|
||||
| `-n` | `--dry` | `bool` | `false` | Compila e imprime as tarefas na ordem em que elas seriam executadas, sem executá-las. |
|
||||
| `-x` | `--exit-code` | `bool` | `false` | Faz com que o código de saída do comando sendo executado seja repassado pelo Task. |
|
||||
| `-f` | `--force` | `bool` | `false` | Força a execução mesmo quando a tarefa está atualizada. |
|
||||
| `-g` | `--global` | `bool` | `false` | Executa o Taskfile global, de `$HOME/Taskfile.{yml,yaml}`. |
|
||||
| `-h` | `--help` | `bool` | `false` | Mostra a ajuda do Task. |
|
||||
| `-i` | `--init` | `bool` | `false` | Cria um novo Taskfile.yml na pasta atual. |
|
||||
| `-I` | `--interval` | `string` | `5s` | Define um intervalo de tempo diferente ao usar `--watch`, o padrão sendo 5 segundos. Este valor deve ser um [Go Duration](https://pkg.go.dev/time#ParseDuration) válido. |
|
||||
| `-l` | `--list` | `bool` | `false` | Lista as tarefas com descrição do Taskfile atual. |
|
||||
| `-a` | `--list-all` | `bool` | `false` | Lista todas as tarefas, com ou sem descrição. |
|
||||
| | `--sort` | `string` | `default` | Changes the order of the tasks when listed.<br />`default` - Alphanumeric with root tasks first<br />`alphanumeric` - Alphanumeric<br />`none` - No sorting (As they appear in the Taskfile) |
|
||||
| | `--json` | `bool` | `false` | Imprime a saída em [JSON](#json-output). |
|
||||
| `-o` | `--output` | `string` | O padrão é o que está definido no Taskfile, ou então `intervealed`. | Configura o estilo de saída: [`interleaved`/`group`/`prefixed`]. |
|
||||
| | `--output-group-begin` | `string` | | Formato de mensagem a imprimir antes da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-end` | `string` | | Formato de mensagem a imprimir depois da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-error-only` | `bool` | `false` | Oculta saída dos comandos que terminarem sem erro. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executa as tarefas fornecidas na linha de comando em paralelo. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Desabilita impressão. |
|
||||
| `-y` | `--yes` | `bool` | `false` | Assume "yes" as answer to all prompts. |
|
||||
| | `--status` | `bool` | `false` | Sai com código de saída diferente de zero se alguma das tarefas especificadas não estiver atualizada. |
|
||||
| | `--summary` | `bool` | `false` | Mostrar resumo sobre uma tarefa. |
|
||||
| `-t` | `--taskfile` | `string` | `Taskfile.yml` ou `Taskfile.yaml` | |
|
||||
| `-v` | `--verbose` | `bool` | `false` | Habilita modo verboso. |
|
||||
| | `--version` | `bool` | `false` | Mostrar versão do Task. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Habilita o monitoramento de tarefas. |
|
||||
| Abreviação | Modificador | Tipo | Predefinição | Descrição |
|
||||
| ---------- | --------------------------- | -------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-c` | `--color` | `bool` | `true` | Saída colorida. Habilitado por padrão. Defina o modificador como `false` ou use `NO_COLOR=1` para desativar. |
|
||||
| `-C` | `--concurrency` | `int` | `0` | Limitar número de tarefas a serem executadas simultaneamente. Zero significa ilimitado. |
|
||||
| `-d` | `--dir` | `string` | Pasta atual | Define a pasta de execução. |
|
||||
| `-n` | `--dry` | `bool` | `false` | Compila e imprime as tarefas na ordem em que elas seriam executadas, sem executá-las. |
|
||||
| `-x` | `--exit-code` | `bool` | `false` | Faz com que o código de saída do comando sendo executado seja repassado pelo Task. |
|
||||
| `-f` | `--force` | `bool` | `false` | Força a execução mesmo quando a tarefa está atualizada. |
|
||||
| `-g` | `--global` | `bool` | `false` | Executa o Taskfile global, de `$HOME/Taskfile.{yml,yaml}`. |
|
||||
| `-h` | `--help` | `bool` | `false` | Mostra a ajuda do Task. |
|
||||
| `-i` | `--init` | `bool` | `false` | Cria um novo Taskfile.yml na pasta atual. |
|
||||
| `-I` | `--interval` | `string` | `5s` | Define um intervalo de tempo diferente ao usar `--watch`, o padrão sendo 5 segundos. Este valor deve ser um [Go Duration](https://pkg.go.dev/time#ParseDuration) válido. |
|
||||
| `-l` | `--list` | `bool` | `false` | Lista as tarefas com descrição do Taskfile atual. |
|
||||
| `-a` | `--list-all` | `bool` | `false` | Lista todas as tarefas, com ou sem descrição. |
|
||||
| | `--sort` | `string` | `default` | Muda order das terafas quando listadas.<br />`default` - Ordem alfabética com as tarefas fo Taskfile raíz listadas por primeiro<br />`alphanumeric` - Alfabética<br />`none` - Sem ordenação (mantém a mesma ordem de declaração no Taskfile) |
|
||||
| | `--json` | `bool` | `false` | Imprime a saída em [JSON](#json-output). |
|
||||
| `-o` | `--output` | `string` | O padrão é o que está definido no Taskfile, ou então `intervealed`. | Configura o estilo de saída: [`interleaved`/`group`/`prefixed`]. |
|
||||
| | `--output-group-begin` | `string` | | Formato de mensagem a imprimir antes da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-end` | `string` | | Formato de mensagem a imprimir depois da saída agrupada de uma tarefa. |
|
||||
| | `--output-group-error-only` | `bool` | `false` | Oculta saída dos comandos que terminarem sem erro. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executa as tarefas fornecidas na linha de comando em paralelo. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Desabilita impressão. |
|
||||
| `-y` | `--yes` | `bool` | `false` | Assuma "sim" como resposta a todos os prompts. |
|
||||
| | `--status` | `bool` | `false` | Sai com código de saída diferente de zero se alguma das tarefas especificadas não estiver atualizada. |
|
||||
| | `--summary` | `bool` | `false` | Mostrar resumo sobre uma tarefa. |
|
||||
| `-t` | `--taskfile` | `string` | `Taskfile.yml` ou `Taskfile.yaml` | |
|
||||
| `-v` | `--verbose` | `bool` | `false` | Habilita modo verboso. |
|
||||
| | `--version` | `bool` | `false` | Mostrar versão do Task. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Habilita o monitoramento de tarefas. |
|
||||
|
||||
## Códigos de saída
|
||||
|
||||
O Task às vezes fecha com códigos de saída específicos. These codes are split into three groups with the following ranges:
|
||||
O Task às vezes fecha com códigos de saída específicos. Estes códigos são divididos em três grupos com os seguintes intervalos:
|
||||
|
||||
- Erros gerais (0-99)
|
||||
- Erros de Taskfile (100-199)
|
||||
@@ -73,13 +73,13 @@ Uma lista completa dos códigos de saída e suas descrições podem ser encontra
|
||||
| 202 | O usuário tentou invocar uma tarefa que é interna |
|
||||
| 203 | Há várias tarefas com o mesmo nome ou apelido |
|
||||
| 204 | Uma tarefa foi chamada muitas vezes |
|
||||
| 205 | A task was cancelled by the user |
|
||||
| 205 | A tarefa foi cancelada pelo usuário |
|
||||
|
||||
These codes can also be found in the repository in [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
|
||||
Esses códigos também podem ser encontrados no repositório em [`errors/errors.go`](https://github.com/go-task/task/blob/main/errors/errors.go).
|
||||
|
||||
:::info
|
||||
|
||||
When Task is run with the `-x`/`--exit-code` flag, the exit code of any failed commands will be passed through to the user instead.
|
||||
Quando o Task é executado com o modificador `-x`/`--exit-code`, o código de saída de todos os comandos falhados será passado para o usuário.
|
||||
|
||||
:::
|
||||
|
||||
@@ -109,56 +109,56 @@ Quando estiver usando o modificador `--json` em combinação com o modificador `
|
||||
|
||||
## Variáveis Especiais
|
||||
|
||||
There are some special variables that is available on the templating system:
|
||||
Há algumas variáveis especiais que são acessíveis via template:
|
||||
|
||||
| Var | Description |
|
||||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI. |
|
||||
| `TASK` | The name of the current task. |
|
||||
| `ROOT_DIR` | The absolute path of the root Taskfile. |
|
||||
| `TASKFILE_DIR` | The absolute path of the included Taskfile. |
|
||||
| `USER_WORKING_DIR` | The absolute path of the directory `task` was called from. |
|
||||
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
|
||||
| `TIMESTAMP` | The date object of the greatest timestamp of the files listes in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
|
||||
| `TASK_VERSION` | The current version of task. |
|
||||
| Variável | Descrição |
|
||||
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `CLI_ARGS` | Contém todos os argumentos extras passados depois de `--` quando invocando o Task via linha de comando. |
|
||||
| `TASK` | O nome da tarefa atual. |
|
||||
| `ROOT_DIR` | O caminho absoluto para o Taskfile raíz. |
|
||||
| `TASKFILE_DIR` | O caminho absoluto para o Taskfile incluído. |
|
||||
| `USER_WORKING_DIR` | O caminho absoluto a partir do qual o comando `task` foi invocado. |
|
||||
| `CHECKSUM` | O "checksum" dos arquivos listados em `sources`. Apenas disponível dentro do atributo `status` e se o método estiver configurado como `checksum`. |
|
||||
| `TIMESTAMP` | A maior data de modificação entre os arquivos listados em `sources`. Apenas disponível dentro do atributo `status` e se o método estiver configurado como `timestamp`. |
|
||||
| `TASK_VERSION` | A versão atual do Task. |
|
||||
|
||||
## ENV
|
||||
|
||||
Some environment variables can be overriden to adjust Task behavior.
|
||||
Algumas variáveis de ambiente podem ser configuradas para mudar o comportamento do Task.
|
||||
|
||||
| ENV | Default | Description |
|
||||
| -------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| `TASK_TEMP_DIR` | `.task` | Location of the temp dir. Can relative to the project like `tmp/task` or absolute like `/tmp/.task` or `~/.task`. |
|
||||
| `TASK_COLOR_RESET` | `0` | Color used for white. |
|
||||
| `TASK_COLOR_BLUE` | `34` | Color used for blue. |
|
||||
| `TASK_COLOR_GREEN` | `32` | Color used for green. |
|
||||
| `TASK_COLOR_CYAN` | `36` | Color used for cyan. |
|
||||
| `TASK_COLOR_YELLOW` | `33` | Color used for yellow. |
|
||||
| `TASK_COLOR_MAGENTA` | `35` | Color used for magenta. |
|
||||
| `TASK_COLOR_RED` | `31` | Color used for red. |
|
||||
| `FORCE_COLOR` | | Force color output usage. |
|
||||
| Variável de Ambiente | Padrão | Descrição |
|
||||
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `TASK_TEMP_DIR` | `.task` | Caminho da pasta temporária. Pode ser um caminho relativo ao projeto como `tmp/task` ou um caminho absoluto como `/tmp/.task` ou `~/.task`. |
|
||||
| `TASK_COLOR_RESET` | `0` | Cor utilizada para branco. |
|
||||
| `TASK_COLOR_BLUE` | `34` | Cor utilizada para azul. |
|
||||
| `TASK_COLOR_GREEN` | `32` | Cor utilizada para verde. |
|
||||
| `TASK_COLOR_CYAN` | `36` | Cor utilizada para ciano. |
|
||||
| `TASK_COLOR_YELLOW` | `33` | Cor utilizada para amarelo. |
|
||||
| `TASK_COLOR_MAGENTA` | `35` | Cor utilizada para magenta. |
|
||||
| `TASK_COLOR_RED` | `31` | Cor utilizada para vermelho. |
|
||||
| `FORCE_COLOR` | | Forçar saída colorida no terminal. |
|
||||
|
||||
## Taskfile Schema
|
||||
## Esquema do Taskfile
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| ---------- | ---------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `version` | `string` | | Version of the Taskfile. The current version is `3`. |
|
||||
| `output` | `string` | `interleaved` | Output mode. Available options: `interleaved`, `group` and `prefixed`. |
|
||||
| `method` | `string` | `checksum` | Default method in this Taskfile. Can be overriden in a task by task basis. Available options: `checksum`, `timestamp` and `none`. |
|
||||
| `includes` | [`map[string]Include`](#include) | | Additional Taskfiles to be included. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | A set of global variables. |
|
||||
| `env` | [`map[string]Variable`](#variable) | | A set of global environment variables. |
|
||||
| `tasks` | [`map[string]Task`](#task) | | A set of task definitions. |
|
||||
| `silent` | `bool` | `false` | Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis. |
|
||||
| `dotenv` | `[]string` | | A list of `.env` file paths to be parsed. |
|
||||
| `run` | `string` | `always` | Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`. |
|
||||
| `interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
|
||||
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| ---------- | ---------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `version` | `string` | | Versão do Taskfile. A versão mais atual é a `3`. |
|
||||
| `output` | `string` | `interleaved` | Mode de saída. Opções disponíveis: `interleaved`, `group` e `prefixed`. |
|
||||
| `method` | `string` | `checksum` | O método padrão deste Taskfile. Pode ser sobre-escrito em cada tarefa individual. Opções disponíveis: `checksum` (conteúdo dos arquivos), `timestamp` (data/hora de modificação) e `none` (nenhum). |
|
||||
| `includes` | [`map[string]Include`](#include) | | Taskfiles adicionais a serem incluídos. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Um conjunto de variáveis globais. |
|
||||
| `env` | [`map[string]Variable`](#variable) | | Um conjunto de variáveis de ambiente globais. |
|
||||
| `tasks` | [`map[string]Task`](#task) | | Um conjunto de tarefas. |
|
||||
| `silent` | `bool` | `false` | Opção padrão para `silent` para este Taskfile. Se `false`, pode ser sobre-escrito com `true` em cada tarefa individual. |
|
||||
| `dotenv` | `[]string` | | Uma lista de arquivos `.env` para serem incluídos. |
|
||||
| `run` | `string` | `always` | Opção padrão para `run` para este Taskfile. Opções disponíveis: `always` (sempre), `once` (uma vez) e `when_changed` (quando mudou). |
|
||||
| `interval` | `string` | `5s` | Configura um intervalo de tempo diferente para `--watch`, sendo que o padrão é de 5 segundos. Essa string deve ser um [Go Duration](https://pkg.go.dev/time#ParseDuration) válido. |
|
||||
| `set` | `[]string` | | Configura opções para o builtin [`set`](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
|
||||
| `shopt` | `[]string` | | Configura opções para o builtin [`shopt`](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
|
||||
|
||||
### Include
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| ---------- | --------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `taskfile` | `string` | | The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile. |
|
||||
| `dir` | `string` | The parent Taskfile directory | The working directory of the included tasks when run. |
|
||||
@@ -180,10 +180,10 @@ includes:
|
||||
|
||||
### Variable
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| --------- | -------- | ------- | ------------------------------------------------------------------------ |
|
||||
| _itself_ | `string` | | A static value that will be set to the variable. |
|
||||
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| -------- | -------- | ------ | ------------------------------------------------------------------------ |
|
||||
| _itself_ | `string` | | A static value that will be set to the variable. |
|
||||
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
|
||||
|
||||
:::info
|
||||
|
||||
@@ -200,7 +200,7 @@ vars:
|
||||
|
||||
### Task
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| --------------- | ---------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cmds` | [`[]Command`](#command) | | A list of shell commands to be executed. |
|
||||
| `deps` | [`[]Dependency`](#dependency) | | A list of dependencies of this task. Tasks defined here will run in parallel before this task. |
|
||||
@@ -248,7 +248,7 @@ tasks:
|
||||
|
||||
#### Command
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| -------------- | ---------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cmd` | `string` | | The shell command to be executed. |
|
||||
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
|
||||
@@ -276,11 +276,11 @@ tasks:
|
||||
|
||||
#### Dependency
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| --------- | ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `task` | `string` | | The task to be execute as a dependency. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
|
||||
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| -------- | ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `task` | `string` | | The task to be execute as a dependency. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
|
||||
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. |
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -296,10 +296,10 @@ tasks:
|
||||
|
||||
#### Precondition
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `sh` | `string` | | Command to be executed. If a non-zero exit code is returned, the task errors without executing its commands. |
|
||||
| `msg` | `string` | | Optional message to print if the precondition isn't met. |
|
||||
| Atributo | Tipo | Padrão | Descrição |
|
||||
| -------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `sh` | `string` | | Command to be executed. If a non-zero exit code is returned, the task errors without executing its commands. |
|
||||
| `msg` | `string` | | Optional message to print if the precondition isn't met. |
|
||||
|
||||
:::tip
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ sidebar_position: 9
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185), [#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
- Added [experiments documentation](https://taskfile.dev/experiments) to the website ([#1198](https://github.com/go-task/task/issues/1198) by [@pd93](https://github.com/pd93)).
|
||||
- Deprecated `version: 2` schema. This will be removed in the next major release ([#1197](https://github.com/go-task/task/issues/1197), [#1198](https://github.com/go-task/task/issues/1198), [#1199](https://github.com/go-task/task/issues/1199) by [@pd93](https://github.com/pd93)).
|
||||
- Added a new `prompt:` prop to set a warning prompt to be shown before running a potential dangurous task ([#100](https://github.com/go-task/task/issues/100), [#1163](https://github.com/go-task/task/issues/1163) by [@MaxCheetham](https://github.com/MaxCheetham), [Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now possible to declare just `cmd:` in a task, avoiding the more complex `cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
- Support `silent:` when calling another tasks ([#680](https://github.com/go-task/task/issues/680), [#1142](https://github.com/go-task/task/issues/1142) by [@danquah](https://github.com/danquah)).
|
||||
|
||||
@@ -9,7 +9,7 @@ Some of the work to improve the Task ecosystem is done by the community, be it i
|
||||
|
||||
## Translations
|
||||
|
||||
[@DeronW](https://github.com/DeronW) maintains the [Chinese translation](https://task-zh.readthedocs.io/zh_CN/latest/) of the website [on this repository](https://github.com/DeronW/task).
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## Integrations
|
||||
|
||||
@@ -24,6 +24,7 @@ Some installation methods are maintained by third party:
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## More
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ In order to allow Task to evolve quickly, we roll out breaking changes to minor
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of Task to test out experimental features. You can also disable a feature by specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -26,11 +30,11 @@ Each section below details an experiment or deprecation and explains what the fl
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -46,9 +50,21 @@ This notice does not mean that we are immediately removing support for version 2
|
||||
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3 Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment][] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status checks. This can be useful, but we have found that most of the time users only expect the direct task they are calling to be forced and _not_ all of its dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called task. All dependant tasks will have their statuses checked as normal and will only run if Task considers them to be out of date. A new `--force-all` flag will also be added to maintain the current behavior for users that need this functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you should replace all uses of the `--force` flag with `--force-all`. Alternatively, if you want to adopt the new behavior, you can continue to use the `--force` flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
[version-3-release-notes]: https://github.com/go-task/task/releases/tag/v3.0.0
|
||||
[deprecated]: https://img.shields.io/badge/deprecated-red
|
||||
[experiment]: https://img.shields.io/badge/experiment-yellow
|
||||
|
||||
@@ -37,9 +37,13 @@ If you omit a task name, "default" will be assumed.
|
||||
Task will look for the following file names, in order of priority:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
The intention of having the `.dist` variants is to allow projects to have one committed version (`.dist`) while still allowing individual users to override the Taskfile by adding an additional `Taskfile.yml` (which would be on `.gitignore`).
|
||||
|
||||
@@ -65,7 +69,7 @@ In this example, we can run `cd <service>` and `task up` and as long as the `<se
|
||||
|
||||
### Running a global Taskfile
|
||||
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile on either `$HOME/Taskfile.yml` or `$HOME/Taskfile.yaml` paths.
|
||||
If you call Task with the `--global` (alias `-g`) flag, it will look for your home directory instead of your working directory. In short, Task will look for a Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
This is useful to have automation that you can run from anywhere in your system!
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ sidebar_position: 9
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185), [#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
- Added [experiments documentation](https://taskfile.dev/experiments) to the website ([#1198](https://github.com/go-task/task/issues/1198) by [@pd93](https://github.com/pd93)).
|
||||
- Deprecated `version: 2` schema. This will be removed in the next major release ([#1197](https://github.com/go-task/task/issues/1197), [#1198](https://github.com/go-task/task/issues/1198), [#1199](https://github.com/go-task/task/issues/1199) by [@pd93](https://github.com/pd93)).
|
||||
- Added a new `prompt:` prop to set a warning prompt to be shown before running a potential dangurous task ([#100](https://github.com/go-task/task/issues/100), [#1163](https://github.com/go-task/task/issues/1163) by [@MaxCheetham](https://github.com/MaxCheetham), [Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now possible to declare just `cmd:` in a task, avoiding the more complex `cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
- Support `silent:` when calling another tasks ([#680](https://github.com/go-task/task/issues/680), [#1142](https://github.com/go-task/task/issues/1142) by [@danquah](https://github.com/danquah)).
|
||||
|
||||
@@ -9,7 +9,7 @@ sidebar_position: 10
|
||||
|
||||
## Переводчики
|
||||
|
||||
[@DeronW](https://github.com/DeronW) поддерживает [Китайский перевод](https://task-zh.readthedocs.io/zh_CN/latest/) на сайте [в этом репозитории](https://github.com/DeronW/task).
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## Интеграции
|
||||
|
||||
@@ -24,6 +24,7 @@ sidebar_position: 10
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## Дополнительно
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ In order to allow Task to evolve quickly, we roll out breaking changes to minor
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of Task to test out experimental features. You can also disable a feature by specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -26,11 +30,11 @@ Each section below details an experiment or deprecation and explains what the fl
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -46,9 +50,21 @@ This notice does not mean that we are immediately removing support for version 2
|
||||
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3 Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment][] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status checks. This can be useful, but we have found that most of the time users only expect the direct task they are calling to be forced and _not_ all of its dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called task. All dependant tasks will have their statuses checked as normal and will only run if Task considers them to be out of date. A new `--force-all` flag will also be added to maintain the current behavior for users that need this functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you should replace all uses of the `--force` flag with `--force-all`. Alternatively, if you want to adopt the new behavior, you can continue to use the `--force` flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
[version-3-release-notes]: https://github.com/go-task/task/releases/tag/v3.0.0
|
||||
[deprecated]: https://img.shields.io/badge/deprecated-red
|
||||
[experiment]: https://img.shields.io/badge/experiment-yellow
|
||||
|
||||
@@ -37,9 +37,13 @@ Task использует [mvdan.cc/sh](https://mvdan.cc/sh/) - нативный
|
||||
Task будет искать следующие файлы, в порядке приоритета:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
Идея создания вариантов `.dist` заключается в том, чтобы позволить проектам иметь одну фиксированную версию (`.dist`), при этом позволяя отдельным пользователям переопределить Taskfile, добавив дополнительный `Taskfile.yml` (который будет находится в `.gitignore`).
|
||||
|
||||
@@ -65,7 +69,7 @@ tasks:
|
||||
|
||||
### Запуск глобального Taskfile
|
||||
|
||||
Если вы вызовите Task с помощью флага `--global` (псевдоним `-g`), будет искать ваш домашний каталог вместо рабочего каталога. Проще говоря, Task будет искать в `$HOME/Taskfile.yml` или `$HOME/Taskfile.yaml`.
|
||||
Если вы вызовите Task с помощью флага `--global` (псевдоним `-g`), будет искать ваш домашний каталог вместо рабочего каталога. In short, Task will look for a Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
Это полезно, чтобы иметь автоматизацию, которую можно запустить из любого места вашей системы!
|
||||
|
||||
|
||||
@@ -5,6 +5,14 @@ sidebar_position: 9
|
||||
|
||||
# 更新日志
|
||||
|
||||
## v3.26.0 - 2023-06-10
|
||||
|
||||
- Only rewrite checksum files in `.task` if the checksum has changed ([#1185](https://github.com/go-task/task/issues/1185), [#1194](https://github.com/go-task/task/issues/1194) by [@deviantintegral](https://github.com/deviantintegral)).
|
||||
- Added [experiments documentation](https://taskfile.dev/experiments) to the website ([#1198](https://github.com/go-task/task/issues/1198) by [@pd93](https://github.com/pd93)).
|
||||
- Deprecated `version: 2` schema. This will be removed in the next major release ([#1197](https://github.com/go-task/task/issues/1197), [#1198](https://github.com/go-task/task/issues/1198), [#1199](https://github.com/go-task/task/issues/1199) by [@pd93](https://github.com/pd93)).
|
||||
- Added a new `prompt:` prop to set a warning prompt to be shown before running a potential dangurous task ([#100](https://github.com/go-task/task/issues/100), [#1163](https://github.com/go-task/task/issues/1163) by [@MaxCheetham](https://github.com/MaxCheetham), [Documentation](https://taskfile.dev/usage/#warning-prompts)).
|
||||
- Added support for single command task syntax. With this change, it's now possible to declare just `cmd:` in a task, avoiding the more complex `cmds: []` when you have only a single command for that task ([#1130](https://github.com/go-task/task/issues/1130), [#1131](https://github.com/go-task/task/issues/1131) by [@timdp](https://github.com/timdp)).
|
||||
|
||||
## v3.25.0 - 2023-05-22
|
||||
|
||||
- 调用其他任务时支持 `silent:` (由 [@danquah](https://github.com/danquah) 在 [#680](https://github.com/go-task/task/issues/680)、[#1142](https://github.com/go-task/task/issues/1142) 完成)。
|
||||
@@ -13,7 +21,7 @@ sidebar_position: 9
|
||||
- 从此版本开始,FreeBSD 的官方二进制文件将可供下载(由 [@andreynering](https://github.com/andreynering) 在 [#1068](https://github.com/go-task/task/issues/1068) 完成)。
|
||||
- 修复一些被意外抑制的错误(由 [@clintmod](https://github.com/clintmod) 在 [#1134](https://github.com/go-task/task/issues/1134) 修复)。
|
||||
- 修复 Taskfile 中省略 `version` 时的 nil 指针错误(由 [@pd93](https://github.com/pd93) 在 [#1148](https://github.com/go-task/task/issues/1148)、[#1149](https://github.com/go-task/task/issues/1149) 修复)。
|
||||
- 修复 task 不存在时的重复错误消息(由 [@pd93](https://github.com/pd93) 在 [#1141](https://github.com/go-task/task/issues/1141)、[#1144](https://github.com/go-task/task/issues/1144) 修复)。
|
||||
- Fix duplicate error message when a task does not exists ([#1141](https://github.com/go-task/task/issues/1141), [#1144](https://github.com/go-task/task/issues/1144) by [@pd93](https://github.com/pd93)).
|
||||
|
||||
## v3.24.0 - 2023-04-15
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ sidebar_position: 10
|
||||
|
||||
## 翻译
|
||||
|
||||
[@DeronW](https://github.com/DeronW) 在 [此存储库](https://github.com/DeronW/task) 中维护网站的 [中文翻译](https://task-zh.readthedocs.io/zh_CN/latest/)。
|
||||
We use [Crowdin](https://crowdin.com/project/taskfile) to translate our document.
|
||||
|
||||
## 集成
|
||||
|
||||
@@ -24,6 +24,7 @@ sidebar_position: 10
|
||||
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
- [Conda](https://github.com/conda-forge/go-task-feedstock/)
|
||||
|
||||
## 更多
|
||||
|
||||
|
||||
@@ -15,10 +15,14 @@ In order to allow Task to evolve quickly, we roll out breaking changes to minor
|
||||
|
||||
You can enable an experimental feature by:
|
||||
|
||||
1. Using the `--x-{feature}` flag. This is intended for one-off invocations of Task to test out experimental features. You can also disable a feature by specifying a falsy value such as `--x-{feature}=false`.
|
||||
1. Using the `TASK_X_{FEATURE}=1` environment variable. This is intended for permanently enabling experimental features in your environment.
|
||||
1. Using the relevant environment variable in front of a task command. For example, `TASK_X_{FEATURE}=1 task {my-task}`. This is intended for one-off invocations of Task to test out experimental features.
|
||||
1. Using the relevant environment variable in your "dotfiles" (e.g. `.bashrc`, `.zshrc` etc.). This is intended for permanently enabling experimental features in your environment.
|
||||
1. Creating a `.env` file in the same directory as your root Taskfile that contains the relevant environment variables. e.g.
|
||||
|
||||
Flags will always override environment variables.
|
||||
```shell
|
||||
# .env
|
||||
TASK_X_FEATURE=1
|
||||
```
|
||||
|
||||
## Current Experimental Features and Deprecations
|
||||
|
||||
@@ -26,11 +30,11 @@ Each section below details an experiment or deprecation and explains what the fl
|
||||
|
||||
<!-- EXPERIMENT TEMPLATE - Include sections as necessary...
|
||||
|
||||
### ![experiment] <Feature> ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
### ![experiment] {Feature} ([#{issue}](https://github.com/go-task/task/issues/{issue})), ...)
|
||||
|
||||
- Flag to enable: `--x-{feature}`
|
||||
- Env to enable: `TASK_X_{feature}`
|
||||
- Environment variable: `TASK_X_{feature}`
|
||||
- Deprecates: {list any existing functionality that will be deprecated by this experiment}
|
||||
- Breaks: {list any existing functionality that will be broken by this experiment}
|
||||
|
||||
{Short description of the feature}
|
||||
|
||||
@@ -46,9 +50,21 @@ This notice does not mean that we are immediately removing support for version 2
|
||||
|
||||
A list of changes between version 2 and version 3 are available in the [Task v3 Release Notes][version-3-release-notes].
|
||||
|
||||
### ![experiment][] Gentle Force ([#1200](https://github.com/go-task/task/issues/1200))
|
||||
|
||||
- Environment variable: `TASK_X_FORCE=1`
|
||||
- Breaks: `--force` flag
|
||||
|
||||
The `--force` flag currently forces _all_ tasks to run regardless of the status checks. This can be useful, but we have found that most of the time users only expect the direct task they are calling to be forced and _not_ all of its dependant tasks.
|
||||
|
||||
This experiment changes the `--force` flag to only force the directly called task. All dependant tasks will have their statuses checked as normal and will only run if Task considers them to be out of date. A new `--force-all` flag will also be added to maintain the current behavior for users that need this functionality.
|
||||
|
||||
If you want to migrate, but continue to force all dependant tasks to run, you should replace all uses of the `--force` flag with `--force-all`. Alternatively, if you want to adopt the new behavior, you can continue to use the `--force` flag as you do now!
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
[deprecate-version-2-schema]: https://github.com/go-task/task/issues/1197
|
||||
[version-3-release-notes]: https://github.com/go-task/task/releases/tag/v3.0.0
|
||||
[deprecated]: https://img.shields.io/badge/deprecated-red
|
||||
[experiment]: https://img.shields.io/badge/experiment-yellow
|
||||
|
||||
@@ -37,9 +37,13 @@ Task 使用 [mvdan.cc/sh](https://mvdan.cc/sh/),一个原生的 Go sh 解释
|
||||
Task 会按以下顺序查找配置文件:
|
||||
|
||||
- Taskfile.yml
|
||||
- taskfile.yml
|
||||
- Taskfile.yaml
|
||||
- taskfile.yaml
|
||||
- Taskfile.dist.yml
|
||||
- taskfile.dist.yml
|
||||
- Taskfile.dist.yaml
|
||||
- taskfile.dist.yaml
|
||||
|
||||
使用 `.dist` 变体的目的是允许项目有一个提交版本 (`.dist`),同时仍然允许个人用户通过添加额外的 `Taskfile.yml`(将在 `.gitignore` 上)来覆盖 Taskfile。
|
||||
|
||||
@@ -65,7 +69,7 @@ tasks:
|
||||
|
||||
### 运行全局 Taskfile
|
||||
|
||||
如果您使用 `--global`(别名 `-g`)标志调用 Task,它将查找您的 home 目录而不是您的工作目录。 简而言之,Task 将在 `$HOME/Taskfile.yml` 或 `$HOME/Taskfile.yaml` 路径上寻找 Taskfile。
|
||||
如果您使用 `--global`(别名 `-g`)标志调用 Task,它将查找您的 home 目录而不是您的工作目录。 In short, Task will look for a Taskfile that matches `$HOME/{T,t}askfile.{yml,yaml}` .
|
||||
|
||||
这对于您可以在系统的任何地方运行的自动化很有用!
|
||||
|
||||
|
||||
@@ -13,9 +13,49 @@
|
||||
--ifm-color-primary-lightest: #5D9993;
|
||||
--ifm-code-font-size: 95%;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||
|
||||
--ifm-navbar-link-color: #fffdf9;
|
||||
--ifm-navbar-link-hover-color: #fffdf9;
|
||||
}
|
||||
.menu__link--sublist.menu__link--active,
|
||||
.menu__link--sublist.menu__link--active:hover {
|
||||
background-color: #43aba2 !important;
|
||||
}
|
||||
|
||||
[data-theme='dark'] {
|
||||
[data-theme='light'] {
|
||||
--ifm-background-color: #fffdf9;
|
||||
--ifm-background-surface-color: #2b2d31;
|
||||
--ifm-color-primary: #43aba2;
|
||||
--ifm-dropdown-link-color: #fffdf9;
|
||||
--ifm-link-color: #43aba2;
|
||||
--ifm-breadcrumb-color-active: #2b2d31;
|
||||
}
|
||||
|
||||
.menu, .navbar, .navbar-sidebar {
|
||||
--ifm-menu-color-background-active: #43aba2;
|
||||
--ifm-menu-color-active: #fffdf9;
|
||||
}
|
||||
.navbar, .navbar-sidebar {
|
||||
--ifm-menu-color: #fffdf9;
|
||||
}
|
||||
.navbar-sidebar__back {
|
||||
color: #fffdf9;
|
||||
}
|
||||
|
||||
[data-theme='light'] svg[class*="lightToggleIcon"],
|
||||
[data-theme='light'] .navbar__toggle {
|
||||
color: #fffdf9 !important;
|
||||
}
|
||||
|
||||
[data-theme='light'] div[class*="codeBlockTitle"],
|
||||
[data-theme='light'] code[class*="codeBlockLines"] {
|
||||
background-color: #f7f5f1 !important;
|
||||
}
|
||||
|
||||
[data-theme='dark'], .footer--dark {
|
||||
--ifm-background-color: #242526 !important;
|
||||
--ifm-background-surface-color: #2b2d31 !important;
|
||||
--ifm-footer-background-color: #2b2d31 !important;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
|
||||
36
docs/static/schema.json
vendored
36
docs/static/schema.json
vendored
@@ -184,6 +184,10 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"requires": {
|
||||
"description": "A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run",
|
||||
"$ref": "#/definitions/3/requires_obj"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -208,7 +212,21 @@
|
||||
},
|
||||
"set": {
|
||||
"type": "string",
|
||||
"enum": ["allexport", "a", "errexit", "e", "noexec", "n", "noglob", "f", "nounset", "u", "xtrace", "x", "pipefail"]
|
||||
"enum": [
|
||||
"allexport",
|
||||
"a",
|
||||
"errexit",
|
||||
"e",
|
||||
"noexec",
|
||||
"n",
|
||||
"noglob",
|
||||
"f",
|
||||
"nounset",
|
||||
"u",
|
||||
"xtrace",
|
||||
"x",
|
||||
"pipefail"
|
||||
]
|
||||
},
|
||||
"shopt": {
|
||||
"type": "string",
|
||||
@@ -352,6 +370,18 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requires_obj": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vars": {
|
||||
"description": "List of variables that must be defined for the task to run",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -375,8 +405,8 @@
|
||||
"output": {
|
||||
"description": "Defines how the STDOUT and STDERR are printed when running tasks in parallel. The interleaved output prints lines in real time (default). The group output will print the entire output of a command once, after it finishes, so you won't have live feedback for commands that take a long time to run. The prefix output will prefix every line printed by a command with [task-name] as the prefix, but you can customize the prefix for a command with the prefix: attribute.",
|
||||
"anyOf": [
|
||||
{"$ref": "#/definitions/3/outputString"},
|
||||
{"$ref": "#/definitions/3/outputObject"}
|
||||
{ "$ref": "#/definitions/3/outputString" },
|
||||
{ "$ref": "#/definitions/3/outputObject" }
|
||||
]
|
||||
},
|
||||
"method": {
|
||||
|
||||
@@ -23,6 +23,7 @@ const (
|
||||
CodeTaskNameConflict
|
||||
CodeTaskCalledTooManyTimes
|
||||
CodeTaskCancelled
|
||||
CodeTaskMissingRequiredVars
|
||||
)
|
||||
|
||||
// TaskError extends the standard error interface with a Code method. This code will
|
||||
|
||||
@@ -105,10 +105,7 @@ type TaskCancelledByUserError struct {
|
||||
}
|
||||
|
||||
func (err *TaskCancelledByUserError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
`task: Task "%q" cancelled by user`,
|
||||
err.TaskName,
|
||||
)
|
||||
return fmt.Sprintf(`task: Task %q cancelled by user`, err.TaskName)
|
||||
}
|
||||
|
||||
func (err *TaskCancelledByUserError) Code() int {
|
||||
@@ -122,7 +119,7 @@ type TaskCancelledNoTerminalError struct {
|
||||
|
||||
func (err *TaskCancelledNoTerminalError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
`task: Task "%q" cancelled because it has a prompt and the environment is not a terminal. Use --yes (-y) to run anyway.`,
|
||||
`task: Task %q cancelled because it has a prompt and the environment is not a terminal. Use --yes (-y) to run anyway.`,
|
||||
err.TaskName,
|
||||
)
|
||||
}
|
||||
@@ -130,3 +127,21 @@ func (err *TaskCancelledNoTerminalError) Error() string {
|
||||
func (err *TaskCancelledNoTerminalError) Code() int {
|
||||
return CodeTaskCancelled
|
||||
}
|
||||
|
||||
// TaskMissingRequiredVars is returned when a task is missing required variables.
|
||||
type TaskMissingRequiredVars struct {
|
||||
TaskName string
|
||||
MissingVars []string
|
||||
}
|
||||
|
||||
func (err *TaskMissingRequiredVars) Error() string {
|
||||
return fmt.Sprintf(
|
||||
`task: Task %q cancelled because it is missing required variables: %s`,
|
||||
err.TaskName,
|
||||
strings.Join(err.MissingVars, ", "),
|
||||
)
|
||||
}
|
||||
|
||||
func (err *TaskMissingRequiredVars) Code() int {
|
||||
return CodeTaskMissingRequiredVars
|
||||
}
|
||||
|
||||
8
go.mod
8
go.mod
@@ -14,10 +14,10 @@ require (
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.4
|
||||
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6
|
||||
golang.org/x/sync v0.2.0
|
||||
golang.org/x/term v0.8.0
|
||||
golang.org/x/sync v0.3.0
|
||||
golang.org/x/term v0.9.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
mvdan.cc/sh/v3 v3.6.0
|
||||
mvdan.cc/sh/v3 v3.7.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -26,6 +26,6 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/sys v0.9.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
)
|
||||
|
||||
20
go.sum
20
go.sum
@@ -6,7 +6,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
@@ -27,7 +27,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE=
|
||||
github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 h1:3RPlVWzZ/PDqmVuf/FKHARG5EMid/tl7cv54Sw/QRVY=
|
||||
github.com/sajari/fuzzy v1.0.0 h1:+FmwVvJErsd0d0hAPlj4CxqxUtQY/fOoY0DwX4ykpRY=
|
||||
github.com/sajari/fuzzy v1.0.0/go.mod h1:OjYR6KxoWOe9+dOlXeiCJd4dIbED4Oo8wpS89o0pwOo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
@@ -43,13 +43,13 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6 h1:Ic9KukPQ7PegFzHckNiMTQXGgEszA7mY2Fn4ZMtnMbw=
|
||||
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
|
||||
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
|
||||
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@@ -57,5 +57,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/sh/v3 v3.6.0 h1:gtva4EXJ0dFNvl5bHjcUEvws+KRcDslT8VKheTYkbGU=
|
||||
mvdan.cc/sh/v3 v3.6.0/go.mod h1:U4mhtBLZ32iWhif5/lD+ygy1zrgaQhUu+XFy7C8+TTA=
|
||||
mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg=
|
||||
mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8=
|
||||
|
||||
@@ -59,7 +59,7 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
|
||||
r, err := interp.New(
|
||||
interp.Params(params...),
|
||||
interp.Env(expand.ListEnviron(environ...)),
|
||||
interp.ExecHandler(interp.DefaultExecHandler(15*time.Second)),
|
||||
interp.ExecHandlers(execHandler),
|
||||
interp.OpenHandler(openHandler),
|
||||
interp.StdIO(opts.Stdin, opts.Stdout, opts.Stderr),
|
||||
dirOption(opts.Dir),
|
||||
@@ -113,6 +113,10 @@ func Expand(s string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func execHandler(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
|
||||
return interp.DefaultExecHandler(15 * time.Second)
|
||||
}
|
||||
|
||||
func openHandler(ctx context.Context, path string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
|
||||
if path == "/dev/null" {
|
||||
return devNull{}, nil
|
||||
|
||||
44
internal/experiments/experiments.go
Normal file
44
internal/experiments/experiments.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package experiments
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
)
|
||||
|
||||
const envPrefix = "TASK_X_"
|
||||
|
||||
var GentleForce bool
|
||||
|
||||
func init() {
|
||||
readDotEnv()
|
||||
GentleForce = parseEnv("GENTLE_FORCE")
|
||||
}
|
||||
|
||||
func parseEnv(xName string) bool {
|
||||
envName := fmt.Sprintf("%s%s", envPrefix, xName)
|
||||
return os.Getenv(envName) == "1"
|
||||
}
|
||||
|
||||
func readDotEnv() {
|
||||
env, _ := godotenv.Read()
|
||||
// If the env var is an experiment, set it.
|
||||
for key, value := range env {
|
||||
if strings.HasPrefix(key, envPrefix) {
|
||||
os.Setenv(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func List(l *logger.Logger) error {
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 6, ' ', 0)
|
||||
l.FOutf(w, logger.Yellow, "* ")
|
||||
l.FOutf(w, logger.Green, "GENTLE_FORCE")
|
||||
l.FOutf(w, logger.Default, ": \t%t\n", GentleForce)
|
||||
return w.Flush()
|
||||
}
|
||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "@go-task/cli",
|
||||
"version": "3.26.0",
|
||||
"version": "3.27.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@go-task/cli",
|
||||
"version": "3.25.0",
|
||||
"version": "3.26.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@go-task/go-npm": "^0.1.17"
|
||||
"@go-task/go-npm": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@go-task/go-npm": {
|
||||
"version": "0.1.18",
|
||||
"resolved": "https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.1.18.tgz",
|
||||
"integrity": "sha512-7Y/sfNgDflsEIpm7+XGnSIZknykn20EwV5ebKNXyK4QKFMu5i7h7W3xjXgY7e4hwiV33uxpcSfOvUX0v9PGZrQ==",
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.2.0.tgz",
|
||||
"integrity": "sha512-vQbdtBvesHm8EUFHX8QKg4rbBodmu9VsAXH1ozpbiN5jdTMOYHTCMM31EurAYmY+rNNtxJQ4JGy6t383RPlqbw==",
|
||||
"bin": {
|
||||
"go-npm": "bin/index.js"
|
||||
}
|
||||
@@ -24,9 +24,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@go-task/go-npm": {
|
||||
"version": "0.1.18",
|
||||
"resolved": "https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.1.18.tgz",
|
||||
"integrity": "sha512-7Y/sfNgDflsEIpm7+XGnSIZknykn20EwV5ebKNXyK4QKFMu5i7h7W3xjXgY7e4hwiV33uxpcSfOvUX0v9PGZrQ=="
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@go-task/go-npm/-/go-npm-0.2.0.tgz",
|
||||
"integrity": "sha512-vQbdtBvesHm8EUFHX8QKg4rbBodmu9VsAXH1ozpbiN5jdTMOYHTCMM31EurAYmY+rNNtxJQ4JGy6t383RPlqbw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@go-task/cli",
|
||||
"version": "3.26.0",
|
||||
"version": "3.27.1",
|
||||
"description": "A task runner / simpler Make alternative written in Go",
|
||||
"scripts": {
|
||||
"postinstall": "go-npm install",
|
||||
@@ -29,6 +29,6 @@
|
||||
},
|
||||
"homepage": "https://taskfile.dev",
|
||||
"dependencies": {
|
||||
"@go-task/go-npm": "^0.1.17"
|
||||
"@go-task/go-npm": "^0.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
35
requires.go
Normal file
35
requires.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-task/task/v3/errors"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
func (e *Executor) areTaskRequiredVarsSet(ctx context.Context, t *taskfile.Task, call taskfile.Call) error {
|
||||
if t.Requires == nil || len(t.Requires.Vars) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
vars, err := e.Compiler.GetVariables(t, call)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var missingVars []string
|
||||
for _, requiredVar := range t.Requires.Vars {
|
||||
if !vars.Exists(requiredVar) {
|
||||
missingVars = append(missingVars, requiredVar)
|
||||
}
|
||||
}
|
||||
|
||||
if len(missingVars) > 0 {
|
||||
return &errors.TaskMissingRequiredVars{
|
||||
TaskName: t.Name(),
|
||||
MissingVars: missingVars,
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
10
task.go
10
task.go
@@ -50,6 +50,7 @@ type Executor struct {
|
||||
TempDir string
|
||||
Entrypoint string
|
||||
Force bool
|
||||
ForceAll bool
|
||||
Watch bool
|
||||
Verbose bool
|
||||
Silent bool
|
||||
@@ -154,7 +155,7 @@ func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error {
|
||||
return &errors.TaskCancelledNoTerminalError{TaskName: call.Task}
|
||||
}
|
||||
|
||||
e.Logger.Outf(logger.Yellow, "task: %q [y/N]\n", t.Prompt)
|
||||
e.Logger.Outf(logger.Yellow, "task: %q [y/N]: ", t.Prompt)
|
||||
|
||||
reader := bufio.NewReader(e.Stdin)
|
||||
userInput, err := reader.ReadString('\n')
|
||||
@@ -179,11 +180,16 @@ func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !e.Force {
|
||||
skipFingerprinting := e.ForceAll || (call.Direct && e.Force)
|
||||
if !skipFingerprinting {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := e.areTaskRequiredVarsSet(ctx, t, call); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
preCondMet, err := e.areTaskPreconditionsMet(ctx, t)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
46
task_test.go
46
task_test.go
@@ -2120,3 +2120,49 @@ func TestSilence(t *testing.T) {
|
||||
|
||||
buff.Reset()
|
||||
}
|
||||
|
||||
func TestForce(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
env map[string]string
|
||||
force bool
|
||||
forceAll bool
|
||||
}{
|
||||
{
|
||||
name: "force",
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
name: "force-all",
|
||||
forceAll: true,
|
||||
},
|
||||
{
|
||||
name: "force with gentle force experiment",
|
||||
force: true,
|
||||
env: map[string]string{
|
||||
"TASK_X_GENTLE_FORCE": "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "force-all with gentle force experiment",
|
||||
forceAll: true,
|
||||
env: map[string]string{
|
||||
"TASK_X_GENTLE_FORCE": "1",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
var buff bytes.Buffer
|
||||
e := task.Executor{
|
||||
Dir: "testdata/force",
|
||||
Stdout: &buff,
|
||||
Stderr: &buff,
|
||||
Force: tt.force,
|
||||
ForceAll: tt.forceAll,
|
||||
}
|
||||
require.NoError(t, e.Setup())
|
||||
require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-dep", Direct: true}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,5 @@ type Call struct {
|
||||
Task string
|
||||
Vars *Vars
|
||||
Silent bool
|
||||
Direct bool // Was the task called directly or via another task?
|
||||
}
|
||||
|
||||
@@ -21,9 +21,13 @@ var (
|
||||
|
||||
defaultTaskfiles = []string{
|
||||
"Taskfile.yml",
|
||||
"taskfile.yml",
|
||||
"Taskfile.yaml",
|
||||
"taskfile.yaml",
|
||||
"Taskfile.dist.yml",
|
||||
"taskfile.dist.yml",
|
||||
"Taskfile.dist.yaml",
|
||||
"taskfile.dist.yaml",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
18
taskfile/requires.go
Normal file
18
taskfile/requires.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package taskfile
|
||||
|
||||
import "github.com/go-task/task/v3/internal/deepcopy"
|
||||
|
||||
// Requires represents a set of required variables necessary for a task to run
|
||||
type Requires struct {
|
||||
Vars []string
|
||||
}
|
||||
|
||||
func (r *Requires) DeepCopy() *Requires {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &Requires{
|
||||
Vars: deepcopy.Slice(r.Vars),
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ type Task struct {
|
||||
Desc string
|
||||
Prompt string
|
||||
Summary string
|
||||
Requires *Requires
|
||||
Aliases []string
|
||||
Sources []string
|
||||
Generates []string
|
||||
@@ -99,6 +100,7 @@ func (t *Task) UnmarshalYAML(node *yaml.Node) error {
|
||||
IgnoreError bool `yaml:"ignore_error"`
|
||||
Run string
|
||||
Platforms []*Platform
|
||||
Requires *Requires
|
||||
}
|
||||
if err := node.Decode(&task); err != nil {
|
||||
return err
|
||||
@@ -135,6 +137,7 @@ func (t *Task) UnmarshalYAML(node *yaml.Node) error {
|
||||
t.IgnoreError = task.IgnoreError
|
||||
t.Run = task.Run
|
||||
t.Platforms = task.Platforms
|
||||
t.Requires = task.Requires
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -178,6 +181,7 @@ func (t *Task) DeepCopy() *Task {
|
||||
IncludedTaskfile: t.IncludedTaskfile.DeepCopy(),
|
||||
Platforms: deepcopy.Slice(t.Platforms),
|
||||
Location: t.Location.DeepCopy(),
|
||||
Requires: t.Requires.DeepCopy(),
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
19
testdata/force/Taskfile.yml
vendored
Normal file
19
testdata/force/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
task-with-dep:
|
||||
status: [ test true ]
|
||||
deps: [ indirect ]
|
||||
cmds:
|
||||
- echo "direct"
|
||||
|
||||
task-with-subtask:
|
||||
status: [ test true ]
|
||||
cmds:
|
||||
- task: indirect
|
||||
- echo "direct"
|
||||
|
||||
indirect:
|
||||
status: [ test true ]
|
||||
cmds:
|
||||
- echo "indirect"
|
||||
@@ -68,6 +68,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf
|
||||
IncludedTaskfileVars: origTask.IncludedTaskfileVars,
|
||||
Platforms: origTask.Platforms,
|
||||
Location: origTask.Location,
|
||||
Requires: origTask.Requires,
|
||||
}
|
||||
new.Dir, err = execext.Expand(new.Dir)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user