This PR contains the work done to support input parameters for the `create` command of the executable target, and to render content dynamically for the newly-generated project. Reviewed-on: #4 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
39 lines
698 B
Swift
39 lines
698 B
Swift
import ColibriLibrary
|
|
|
|
final class TemplateServiceSpy {
|
|
|
|
// MARK: Properties
|
|
|
|
private(set) var actions: [Action] = []
|
|
|
|
}
|
|
|
|
// MARK: - TemplateServicing
|
|
|
|
extension TemplateServiceSpy: TemplateServicing {
|
|
|
|
// MARK: Functions
|
|
|
|
@discardableResult
|
|
func render(_ object: Any, on template: String) async throws (TemplateServiceError) -> String {
|
|
actions.append(.rendered(object, template))
|
|
|
|
return .content
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Actions
|
|
|
|
extension TemplateServiceSpy {
|
|
enum Action {
|
|
case rendered(_ object: Any, _ template: String)
|
|
}
|
|
}
|
|
|
|
// MARK: - String+Constants
|
|
|
|
private extension String {
|
|
static let content = ""
|
|
}
|