MCPcopy Index your code
hub / github.com/dagger/dagger / functionName

Function functionName

cmd/dagger/function_name.go:22–46  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

20}
21
22func functionName(args []string) string {
23 if len(args) == 0 {
24 return ""
25 }
26
27 for _, arg := range args {
28 if strings.HasPrefix(arg, "-") {
29 if !strings.Contains(arg, "=") {
30 // this flag is not self-contained so we can't be sure what the
31 // top level function is
32 return ""
33 }
34 // it is a self contained flag os we are fine to continue scanning
35 continue
36 }
37
38 // we have the first non-flag argument which should be the top level function
39 // name so we return it
40 return arg
41 }
42
43 // weird case that would happen when users make a dagger call with no functions
44 // an edge-case but we cover it anyway
45 return ""
46}

Callers 2

TestFunctionNameFunction · 0.85
initModuleParamsFunction · 0.85

Calls 1

ContainsMethod · 0.65

Tested by 1

TestFunctionNameFunction · 0.68