LoadProtonTemplatesFromDir loads all .yaml template files from a directory.
(dir string)
| 280 | |
| 281 | // LoadProtonTemplatesFromDir loads all .yaml template files from a directory. |
| 282 | func 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. |
| 299 | func ProtonExtractorNames() []string { |
no test coverage detected