Automate Lesson Creation From Templates With ZSH Functions

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

ZSH allows you to write functions to wrap around common commands. These allow you to easiest invoke a number of lesson creation steps by only typing out the command.

John Lindquist: [0:00] I've created a +Vanilla ZSH function, which goes into my projects directory, pulls down my template with the name that's passed in, then goes into that directory, Git initializes it, adds it, adds a commit message, uses Hub to create my repo on GitHub, pushes what I created, runs my installs, then opens code and starts my project.

[0:22] In practice, that looks like this. +vanilla, and I'll just call my lesson array-reduce or something. Hit Enter, and you can watch clone and create it on GitHub. Then it'll start installing everything. Then automatically launch it in code.

[0:42] I got a popup that I don't have a gitignore set up. We should definitely add that to our template later. I'll hit Yes to add it automatically now. Then on another window, it also automatically launched my project in a browser. I can immediately just start typing here and see my changes. I have a named project locally, which is already backed up by a project on GitHub.