MCPcopy
hub / github.com/cheat/cheat / Path

Function Path

internal/config/path.go:9–20  ·  view source on GitHub ↗

Path returns the config file path

(paths []string)

Source from the content-addressed store, hash-verified

7
8// Path returns the config file path
9func Path(paths []string) (string, error) {
10
11 // check if the config file exists on any paths
12 for _, p := range paths {
13 if _, err := os.Stat(p); err == nil {
14 return p, nil
15 }
16 }
17
18 // we can't find the config file if we make it this far
19 return "", fmt.Errorf("could not locate config file")
20}

Callers 4

loadConfigFunction · 0.92
runFunction · 0.92
TestPathConfigNotExistsFunction · 0.70
TestPathConfigExistsFunction · 0.70

Calls

no outgoing calls

Tested by 2

TestPathConfigNotExistsFunction · 0.56
TestPathConfigExistsFunction · 0.56