Closed Sherlouk closed 6 years ago
An idea here would be to create the ability to write custom post-generation text processors:
protocol TextProcessor {
func process(input: String) throws -> String
}
struct RemoveSwiftOnoneSupport: TextProcessor {
func process(input: String) throws -> String {
return input.replacingOccurrences(of: "\nimport SwiftOnoneSupport", with: "")
}
}
Then apply them to the generated source:
var textProcessors: [TextProcessor] = [
RemoveSwiftOnoneSupport()
]
if options.noDocumentation {
textProcessors.append(RemoveComments())
}
do {
source = try textProcessors.reduce(source, { try $1.process(input: $0) })
} catch {
return .failure(.unexpectedError(error: error))
}
SwiftOnoneSupport