MCPcopy Create free account
hub / github.com/chainreactors/spray / LoadProtonTemplatesFromDir

Function LoadProtonTemplatesFromDir

pkg/proton.go:282–296  ·  view source on GitHub ↗

LoadProtonTemplatesFromDir loads all .yaml template files from a directory.

(dir string)

Source from the content-addressed store, hash-verified

280
281// LoadProtonTemplatesFromDir loads all .yaml template files from a directory.
282func LoadProtonTemplatesFromDir(dir string) error {
283 var docs [][]byte
284 filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
285 if err != nil || info.IsDir() || !strings.HasSuffix(path, ".yaml") {
286 return nil
287 }
288 data, err := os.ReadFile(path)
289 if err != nil {
290 return nil
291 }
292 docs = append(docs, data)
293 return nil
294 })
295 return LoadProtonTemplates(docs)
296}
297
298// ProtonExtractorNames returns all available template IDs.
299func ProtonExtractorNames() []string {

Callers 1

PrepareMethod · 0.92

Calls 2

LoadProtonTemplatesFunction · 0.85
IsDirMethod · 0.80

Tested by

no test coverage detected