Skip to content

Commit 45c23cb

Browse files
committed
Add support form * in include paths
1 parent 2084450 commit 45c23cb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/CreateAPI/Generator/Generator+Paths.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ extension Generator {
135135

136136
private func shouldGenerate(path: String) -> Bool {
137137
if !options.paths.include.isEmpty {
138-
return options.paths.include.contains(path)
138+
return options.paths.include.contains(where: { include in
139+
switch (include.first, include.last, include) {
140+
case ("*", "*", _): return include.contains(path.dropFirst().dropLast())
141+
case ("*", _, _): return path.hasSuffix(include.dropFirst())
142+
case (_, "*", _): return path.hasPrefix(include.dropLast())
143+
default: return include == path
144+
}
145+
})
139146
}
140147
if !options.paths.exclude.isEmpty {
141148
return !options.paths.exclude.contains(path)

0 commit comments

Comments
 (0)