MCPcopy
hub / github.com/go-task/task / Parse

Function Parse

args/args.go:27–42  ·  view source on GitHub ↗

Parse parses command line argument: tasks and global variables

(args ...string)

Source from the content-addressed store, hash-verified

25
26// Parse parses command line argument: tasks and global variables
27func Parse(args ...string) ([]*task.Call, *ast.Vars) {
28 calls := []*task.Call{}
29 globals := ast.NewVars()
30
31 for _, arg := range args {
32 if !strings.Contains(arg, "=") {
33 calls = append(calls, &task.Call{Task: arg})
34 continue
35 }
36
37 name, value := splitVar(arg)
38 globals.Set(name, ast.Var{Value: value})
39 }
40
41 return calls, globals
42}
43
44func ToQuotedString(args []string) (string, error) {
45 var quotedCliArgs []string

Callers 2

runFunction · 0.92
TestArgsFunction · 0.92

Calls 3

SetMethod · 0.95
NewVarsFunction · 0.92
splitVarFunction · 0.85

Tested by 1

TestArgsFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…