Select a Lesson Template From an Alfred Workflow

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

Alfred is a super speed booster when it comes to common tasks. If you're going to be creating a lot of lessons from templates, Alfred can save you from even opening your terminal.

John Lindquist: [0:00] When you have multiple templates, like a vanilla template and a svelte template, you may want an easier way of picking which one to launch.

[0:07] Let's create a blank workflow. We'll just call this From Template and fromtemplate, then we'll set up a keyboard shortcut Hotkey. We'll use Command-Alt-T, hit Save. Then we want a List Filter. We don't need any arguments here, so No Arguments.

[0:23] We'll create a list like this, with a title of vanilla. The argument can just be +vanilla. Then a title of svelte and + svelte. Connect these together, and then we're going to store the result of that inside of a variable.

[0:37] We'll name this variable command, and that can take the value of the {query}. We don't need to pass the command name along, so we'll delete that from the arguments. We'll connect this so it stores that in a variable.

[0:49] Now we can create a Keyword. We're just going to type in some text for the name of the project, so No Argument and a blank keyword. Hit Save there. Connect these. Then the output of that can be another variable. We'll delete that and name this name with the value of this {query}. Hit Save there.

[1:10] Let's just add some notes. This is the command variable and this is the name variable. This will all end up in a runscript where I'll set this to ZSH. I want to source my zshrc, and then run $command with the $name. Hit Save there. Connect these.

[1:28] Now I want to hit Command-Alt-T. I can pick from vanilla and svelte. I'll pick vanilla. I'll give it a name of my-new-project-from-template. Hit Enter. Then it'll run everything for me behind the scenes and launch code with my project running, everything named properly, and my browser open waiting for code to change.