Do not show unparseable templates
@@ -819,6 +819,7 @@ func (r *Runner) ListAvailableTemplates() {
func(path string, d *godirwalk.Dirent) error {
if !d.IsDir() && strings.HasSuffix(path, ".yaml") {
t, err := r.parse(path)
+ if t != nil {
switch tp := t.(type) {
case *templates.Template:
r.logTemplateLoaded(tp.ID, tp.Info.Name, tp.Info.Author, tp.Info.Severity)
@@ -828,6 +829,7 @@ func (r *Runner) ListAvailableTemplates() {
gologger.Errorf("Could not parse file '%s': %s\n", path, err)
}
}
+ }
return nil
},
)
