Skip to content

Instantly share code, notes, and snippets.

@italomaia
Created November 11, 2018 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save italomaia/8d0886e9deb02bcc02b49eeb91af8d3a to your computer and use it in GitHub Desktop.
Save italomaia/8d0886e9deb02bcc02b49eeb91af8d3a to your computer and use it in GitHub Desktop.
watch and compile moon files
#!/bin/sh
inotifywait -m -r -q --exclude "" -e create -e close_write -e move $(pwd) |
while read path action file; do
if [[ $path == \.moon$ ]]; then
if [ $action = 'MOVED_FROM' ] || [ $action = 'DELETE' ]; then
rm "${path/\.moon$/.lua}"; # clean up lua file
else
moonc $path;
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment