1
0
mirror of https://github.com/go-task/task.git synced 2025-01-22 05:10:17 +02:00

Merge branch 'master' into v3

This commit is contained in:
Andrey Nering 2019-12-07 16:54:29 -03:00
commit d718527a1f
5 changed files with 30 additions and 7 deletions

1
.github/FUNDING.yml vendored
View File

@ -1 +1,2 @@
open_collective: task
patreon: andreynering

View File

@ -32,6 +32,8 @@
- Add `--parallel` flag (alias `-p`) to run tasks given by the command line in
parallel
([#266](https://github.com/go-task/task/pull/266)).
- Fixed bug where calling the `task` CLI only informing global vars would not
execute the `default` task.
## v2.7.1 - 2019-11-10

View File

@ -139,13 +139,7 @@ func main() {
return
}
arguments := pflag.Args()
if len(arguments) == 0 {
e.Logger.Errf(logger.Yellow, "task: No argument given, trying default task")
arguments = []string{"default"}
}
calls, globals := args.Parse(arguments...)
calls, globals := args.Parse(pflag.Args()...)
for name, value := range globals {
e.Taskfile.Vars[name] = value
}

View File

@ -34,6 +34,10 @@ func Parse(args ...string) ([]taskfile.Call, taskfile.Vars) {
}
}
if len(calls) == 0 {
calls = append(calls, taskfile.Call{Task: "default"})
}
return calls, globals
}

View File

@ -64,6 +64,28 @@ func TestArgs(t *testing.T) {
"FOO": {Static: "bar"},
},
},
{
Args: nil,
ExpectedCalls: []taskfile.Call{
{Task: "default"},
},
},
{
Args: []string{},
ExpectedCalls: []taskfile.Call{
{Task: "default"},
},
},
{
Args: []string{"FOO=bar", "BAR=baz"},
ExpectedCalls: []taskfile.Call{
{Task: "default"},
},
ExpectedGlobals: taskfile.Vars{
"FOO": {Static: "bar"},
"BAR": {Static: "baz"},
},
},
}
for i, test := range tests {