MCPcopy
hub / github.com/cli/cli / GlobPaths

Function GlobPaths

pkg/cmdutil/args.go:85–100  ·  view source on GitHub ↗

GlobPaths expands a list of file patterns into a list of file paths. If no files match a pattern, that pattern will return an error. If no pattern is passed, this returns an empty list and no error. For information on supported glob patterns, see https://pkg.go.dev/path/filepath#Match

(patterns []string)

Source from the content-addressed store, hash-verified

83// For information on supported glob patterns, see
84// https://pkg.go.dev/path/filepath#Match
85func GlobPaths(patterns []string) ([]string, error) {
86 expansions := []string{}
87
88 for _, pattern := range patterns {
89 matches, err := filepath.Glob(pattern)
90 if err != nil {
91 return nil, fmt.Errorf("%s: %v", pattern, err)
92 }
93 if len(matches) == 0 {
94 return []string{}, fmt.Errorf("no matches found for `%s`", pattern)
95 }
96 expansions = append(expansions, matches...)
97 }
98
99 return expansions, nil
100}

Callers 3

AssetsFromArgsFunction · 0.92
createRunFunction · 0.92
TestGlobPathsFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestGlobPathsFunction · 0.68