snaptoken / leg

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

Create various step-editing commands that are thin but helpful wrappers over git commands #29

Open paigeruten opened 6 years ago

paigeruten commented 6 years ago

For example, you might be editing a .litdiff file and see a change that needs to be made in step 12. So you run leg edit 12 and it checks out that commit in the repo and copies the working directory to step-12/ and asks you to edit it. You edit it (referring to the original diff in the .litdiff file) and then run leg save to amend the commit. Then a git rebase is done automatically, and if any conflicts come up you will have to handle them one at a time using the same workflow (conflicting commit is copied to step-XX/, you resolve the conflict and then run leg save to continue).

Eventually you might hardly ever have to use git directly to modify the repo, just do everything through leg. When that time comes, the repo/ folder should probably be kept in a .leg/ directory and hidden from the user. Then to the user, there will only be one representation of the tutorial: the .litdiff files. Having one representation will simplify the usage of leg so much, I think multiple representations have always been the thing that makes leg so hard to learn to use.

Update: Yeah. I think I want to hide all git stuff in .leg/ and behind leg commands. leg init would initialize a new git repo and create an empty work directory for you to add your initial file(s) to. leg commit would save the work directory to a new commit (or maybe to an existing commit, depending on context...). The workflow would be really similar to how I first started writing kilo-tutorial using step folders, but way more streamlined and backed directly by git. Yes, this is definitely the way to go.

Commands to implement