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

Function findMatches

command/flag/path.go:186–207  ·  view source on GitHub ↗
(pattern string, formatMatch func(string) string)

Source from the content-addressed store, hash-verified

184}
185
186func findMatches(pattern string, formatMatch func(string) string) []flags.Completion {
187 paths, err := filepath.Glob(pattern)
188 if paths == nil || err != nil {
189 return nil
190 }
191
192 matches := []flags.Completion{}
193 for _, path := range paths {
194 info, err := os.Stat(path)
195 if err != nil {
196 continue
197 }
198
199 formattedMatch := formatMatch(path)
200 if info.IsDir() {
201 formattedMatch = fmt.Sprintf("%s%c", formattedMatch, os.PathSeparator)
202 }
203 matches = append(matches, flags.Completion{Item: formattedMatch})
204 }
205
206 return matches
207}
208
209func completeWithTilde(prefix string) []flags.Completion {
210 var homeDir string

Callers 2

CompleteMethod · 0.85
completeWithTildeFunction · 0.85

Calls 1

IsDirMethod · 0.80

Tested by

no test coverage detected