snaptoken / leg

Tools for making step-by-step code walkthroughs
MIT License
130 stars 2 forks source link

Use file modified-at times to detect whether it's safe to overwrite diff/ or repo/ #12

Closed paigeruten closed 6 years ago

paigeruten commented 6 years ago

This can be used to not require the user to use the -f (force) option all the time. It could also be used to provide a leg sync command that updates the out-of-date representation using the modified representation as the source.

Then, the leg doc command could automatically make sure repo/ is up-to-date before building. So the workflow would be make edits to either diff/ or repo/ and then just run leg doc to build and see the changes.

Implementation: whenever leg diff or leg repo are run (including as a result of running leg sync or leg doc), touch a file named .last_synced and use its timestamp to compare with the diff/ and repo/ folders' timestamps. The repo/ representation's last-modified time should probably be gotten from the latest commit of the repo.