Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,21 @@ func NewApp() *App {

func recursiveTomlSearch(root, tomlType string) ([]string, error) {
var matches []string
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
err := filepath.WalkDir(root, func(path string, entry os.DirEntry, err error) error {
if err != nil {
return err
}

if info.IsDir() || filepath.Ext(info.Name()) != ".toml" {
// Skip certain directories
if entry.IsDir() && (entry.Name() == "venv" || entry.Name() == ".venv" || strings.HasPrefix(entry.Name(), ".")) {
return filepath.SkipDir
}

if entry.IsDir() || filepath.Ext(entry.Name()) != ".toml" {
return nil
}

if info.Name() == tomlType+".toml" || strings.HasSuffix(info.Name(), "."+tomlType+".toml") {
if entry.Name() == tomlType+".toml" || strings.HasSuffix(entry.Name(), "."+tomlType+".toml") {
matches = append(matches, path)
}

Expand Down