MCPcopy Index your code
hub / github.com/cloudfoundry/cli / walkDirAndCountCommand

Function walkDirAndCountCommand

cf/commandsloader/commands_loader_test.go:24–44  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

22})
23
24func walkDirAndCountCommand(path string) int {
25 cmdCount := 0
26
27 filepath.Walk(path, func(p string, info os.FileInfo, err error) error {
28 if err != nil {
29 fmt.Println("Error walking commands directories:", err)
30 return err
31 }
32
33 dir := filepath.Dir(p)
34
35 if !info.IsDir() && !strings.HasSuffix(dir, "fakes") {
36 if strings.HasSuffix(info.Name(), ".go") && !strings.HasSuffix(info.Name(), "_test.go") {
37 cmdCount += 1
38 }
39 }
40 return nil
41 })
42
43 return cmdCount
44}

Callers 1

Calls 3

IsDirMethod · 0.80
NameMethod · 0.80
PrintlnMethod · 0.65

Tested by

no test coverage detected