Skip to content

Commit

Permalink
feat: mlg watch does an initial render (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicKramer committed Apr 13, 2021
1 parent 256a92c commit 1aecc07
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/mathlingua/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,14 @@ private class Watch :
val cwd = Paths.get(".").toAbsolutePath().normalize().toFile()
registerAll(cwd, watchService)

// do an initial render to ensure the docs directory is up-to-date
// even before any changes occur
renderAll(cwd = cwd, stdout = false, noExpand = false)
println()

log("Waiting for changes...")
println()

while (true) {
var doRender = false
val watchKey = watchService.take()
Expand All @@ -614,7 +621,6 @@ private class Watch :
log("Change detected...")
renderAll(cwd = cwd, stdout = false, noExpand = false)
println()
println()
}

watchKey.reset()
Expand Down

0 comments on commit 1aecc07

Please sign in to comment.