If the path to a directory is passed, you need to find all .swift files inside it. For this purpose I wrote a simple but not the most optimal implementation of search:
let contents = try contentsOfDirectory(atPath: path)
var paths: [String] = []
for item in contents {
let itemPath = "\(path)/\(item)"
if item.hasSuffix(".swift") {
paths.append(itemPath)
}
if (try? contentsOfDirectory(atPath: itemPath)) != nil {
paths += listFiles(atPath: itemPath)
}
}
return paths
After, passed the resulting array of strings to sourcery and macro search.
Short description 📝
Adding the ability to specify sources in the
prefire.yml
file.Solution 📦
The easiest thing to do is to make it possible to pass an array of strings with paths through a configuration file. That's what I did.
Example of use:
Implementation 👩💻👨💻
Added a new key for parsing:
If the path to a directory is passed, you need to find all
.swift
files inside it. For this purpose I wrote a simple but not the most optimal implementation of search:After, passed the resulting array of strings to sourcery and macro search.