Add: markdown renderer command flag

This commit is contained in:
Seyed Mojtaba Hosseini Zeidabadi 2022-11-09 17:17:15 +03:30
parent e7f753785e
commit 24f8ae15cf
2 changed files with 17 additions and 0 deletions

View File

@ -22,6 +22,9 @@ class GenerateCommand: ProjectCommand {
@Flag("--only-plists", description: "Generate only plist files")
var onlyPlists: Bool
@Flag("--render-markdowns", description: "Render markdown files with `.md` extension")
var renderMarkdowns: Bool
init(version: Version) {
super.init(version: version,
@ -115,6 +118,16 @@ class GenerateCommand: ProjectCommand {
} catch {
throw GenerationError.writingError(error)
}
// add markdown renderer if needed
if renderMarkdowns {
do {
try fileWriter.writeMarkdownRendererPlist()
success("Created markdown renderer in the project file")
} catch {
throw GenerationError.writingError(error)
}
}
// write cache
if let cacheFile = cacheFile {

View File

@ -40,6 +40,10 @@ public class FileWriter {
}
}
}
public func writeMarkdownRendererPlist() throws {
try writePlist([:], path: project.defaultProjectPath.string.appending("/.xcodesamplecode.plist"))
}
private func writePlist(_ plist: [String: Any], path: String) throws {
let path = project.basePath + path