MCPcopy Create free account
hub / github.com/cli/cli / selectScripts

Function selectScripts

acceptance/scriptfilter_test.go:25–36  ·  view source on GitHub ↗

selectScripts returns the script files under testdata/command that match the requested names, and reports whether a filter was applied (i.e. scripts is non-empty). A named script not found in the directory is silently ignored because it belongs to another command directory in the same run.

(command string, scripts []string)

Source from the content-addressed store, hash-verified

23// non-empty). A named script not found in the directory is silently ignored
24// because it belongs to another command directory in the same run.
25func selectScripts(command string, scripts []string) (files []string, filtered bool) {
26 if len(scripts) == 0 {
27 return nil, false
28 }
29 for _, script := range scripts {
30 p := path.Join("testdata", command, script)
31 if _, err := os.Stat(p); err == nil {
32 files = append(files, p)
33 }
34 }
35 return files, true
36}

Callers 2

testScriptParamsForFunction · 0.85
TestSelectScriptsFunction · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected