add omit md

This commit is contained in:
2026-08-27 14:42:00 +01:00
parent 2bbbf4e81e
commit a2afce3f8d
4 changed files with 22 additions and 1 deletions
+13
View File
@@ -14,6 +14,7 @@ type Filter struct {
Ignores []string
OmitTest bool
FrontendOnly bool
OmitMd bool
}
func (f *Filter) ShouldSkipDir(name string) bool {
@@ -45,6 +46,10 @@ func (f *Filter) ShouldSkipFile(path, name string, info os.FileInfo) bool {
return true
}
if f.OmitMd && isNonReadmeMarkdown(path, name) {
return true
}
if f.FrontendOnly && !isFrontendOrReadme(path, name) {
return true
}
@@ -63,6 +68,14 @@ func (f *Filter) ShouldSkipFile(path, name string, info os.FileInfo) bool {
return false
}
func isNonReadmeMarkdown(path, name string) bool {
ext := strings.ToLower(filepath.Ext(path))
if ext != ".md" && ext != ".markdown" {
return false
}
return !strings.EqualFold(name, "README.md")
}
func isFrontendOrReadme(path, name string) bool {
ext := strings.ToLower(filepath.Ext(path))
for _, fe := range config.FrontendExts {