aboutsummaryrefslogtreecommitdiffstats
path: root/copilot.moon
diff options
context:
space:
mode:
Diffstat (limited to 'copilot.moon')
-rw-r--r--copilot.moon12
1 files changed, 8 insertions, 4 deletions
diff --git a/copilot.moon b/copilot.moon
index 88aa8fa..d0dec92 100644
--- a/copilot.moon
+++ b/copilot.moon
@@ -20,17 +20,21 @@ class Copilot
error "not a file: #{@file}"
patch: =>
+ root = assert (program\match slurp @file), "parse error"
+ @registry\patch_root root
+ spit @file, root\stringify!
+
+ poll: =>
{ :mode, :modification } = (lfs.attributes @file) or {}
if mode != 'file'
return
if @last_modification < modification
print "---"
+ ok, err = pcall @patch, @
+ if not ok
+ print "ERROR: #{err}"
- root = assert (program\match slurp @file), "error parsing"
- @registry\patch_root root
-
- spit @file, root\stringify!
@last_modification = os.time!
:Copilot