fix: filter by filename instead of whole path (#42)

This commit is contained in:
jam 2024-10-24 22:37:01 +09:00 committed by GitHub
parent 64c61dd178
commit 4dd501a2f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ func ReplaceTextInFile(file string, text string, replacement string) error {
func ReplaceTextInDirRecursive(dir string, text string, replacement string, filter func(file string) bool) error {
return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
if filter(path) {
if filter(filepath.Base(path)) {
_ = ReplaceTextInFile(path, text, replacement)
}
return nil