1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

refactor: taskfile/ast package (#1450)

* refactor: ast package

* feat: read -> taskfile

* refactor: taskfile.Taskfile -> taskfile.Read

* refactor: move merge function back into taskfile package

* refactor: rename taskfile.go to read.go
This commit is contained in:
Pete Davison
2023-12-29 20:32:03 +00:00
committed by GitHub
parent 2b67d05b9d
commit 247c2586c2
61 changed files with 471 additions and 468 deletions

View File

@@ -3,22 +3,22 @@ package args
import (
"strings"
"github.com/go-task/task/v3/taskfile"
"github.com/go-task/task/v3/taskfile/ast"
)
// Parse parses command line argument: tasks and global variables
func Parse(args ...string) ([]taskfile.Call, *taskfile.Vars) {
calls := []taskfile.Call{}
globals := &taskfile.Vars{}
func Parse(args ...string) ([]ast.Call, *ast.Vars) {
calls := []ast.Call{}
globals := &ast.Vars{}
for _, arg := range args {
if !strings.Contains(arg, "=") {
calls = append(calls, taskfile.Call{Task: arg, Direct: true})
calls = append(calls, ast.Call{Task: arg, Direct: true})
continue
}
name, value := splitVar(arg)
globals.Set(name, taskfile.Var{Value: value})
globals.Set(name, ast.Var{Value: value})
}
return calls, globals