Access site root globally

This commit is contained in:
Christoph Hagen 2022-09-23 09:22:38 +02:00
parent fdd4c0e4d9
commit 66dcd43082

View File

@ -4,6 +4,7 @@ import ArgumentParser
var configuration: Configuration!
let log = ValidationLog()
var files: FileSystem!
var siteRoot: Element!
@main
struct CHGenerator: ParsableCommand {
@ -25,11 +26,12 @@ private func generate(configPath: String) throws {
in: configuration.contentDirectory,
to: configuration.outputDirectory)
guard let siteData = Element(atRoot: configuration.contentDirectory) else {
siteRoot = Element(atRoot: configuration.contentDirectory)
guard siteRoot != nil else {
return
}
let siteGenerator = try SiteGenerator()
siteGenerator.generate(site: siteData)
siteGenerator.generate(site: siteRoot)
files.printGeneratedPages()
files.printEmptyPages()