Fix bug of Task not executing the "default" task

When global vars were informed using the CLI.

I took the oportunity to move this logic to the proper package and
write a test.
This commit is contained in:
Andrey Nering
2019-12-07 16:20:36 -03:00
parent f0bc4d26a0
commit a4685229c9
4 changed files with 17 additions and 7 deletions

View File

@@ -133,13 +133,7 @@ func main() {
return
}
arguments := pflag.Args()
if len(arguments) == 0 {
log.Println("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
}