Access site root globally
This commit is contained in:
parent
fdd4c0e4d9
commit
66dcd43082
@ -4,6 +4,7 @@ import ArgumentParser
|
|||||||
var configuration: Configuration!
|
var configuration: Configuration!
|
||||||
let log = ValidationLog()
|
let log = ValidationLog()
|
||||||
var files: FileSystem!
|
var files: FileSystem!
|
||||||
|
var siteRoot: Element!
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct CHGenerator: ParsableCommand {
|
struct CHGenerator: ParsableCommand {
|
||||||
@ -25,11 +26,12 @@ private func generate(configPath: String) throws {
|
|||||||
in: configuration.contentDirectory,
|
in: configuration.contentDirectory,
|
||||||
to: configuration.outputDirectory)
|
to: configuration.outputDirectory)
|
||||||
|
|
||||||
guard let siteData = Element(atRoot: configuration.contentDirectory) else {
|
siteRoot = Element(atRoot: configuration.contentDirectory)
|
||||||
|
guard siteRoot != nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let siteGenerator = try SiteGenerator()
|
let siteGenerator = try SiteGenerator()
|
||||||
siteGenerator.generate(site: siteData)
|
siteGenerator.generate(site: siteRoot)
|
||||||
|
|
||||||
files.printGeneratedPages()
|
files.printGeneratedPages()
|
||||||
files.printEmptyPages()
|
files.printEmptyPages()
|
||||||
|
Loading…
Reference in New Issue
Block a user