Last active
July 6, 2016 23:19
-
-
Save emekoi/78e59793f626bcc7b0ece4652c99f9de to your computer and use it in GitHub Desktop.
build_box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
box = {} | |
box.init = -> | |
f = io.open(".rules.moon", "wb") | |
f\write([[ | |
file["main.moon"] = "main.moon" | |
action["main.moon"] = "echo #{file} changed" | |
{:file, :action} | |
]]) | |
f:close! | |
box.watch = -> | |
while true | |
io.write("> ") | |
i = io.read! | |
os.execute(i) | |
box.upd = -> | |
dostring() | |
switch arg[1] | |
when nil | |
print [[ | |
usage: build_box [commands] | |
Available commands are: | |
init create a new build_box environment | |
watch continually watch for changes and run `box upd` accordingly | |
upd check for changes run the predefined commands]] | |
when "init" | |
box.init! | |
when "upd" | |
nil | |
when "watch" | |
box.watch! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment