Loading
scriptkit-showcase 9 exercises
lesson

List and Launch Dev Projects

Developers often keep their dev projects in a specific directory like "dev", "projects", or something similar. Script Kit allows you quickly read all the files of any directory then display them in a list so you can open them in your editor.

[Install open-project](https://scriptkit.com/api/new?name

Loading lesson

Transcript

0:00 Create a script called open project. We'll hit Enter. That launches the script in VS Code. I keep all of my projects in a directory called home inside of the dev folder. If you look at home dev, you'll see that, we'll run this real quick, it resolves to users John Lindquist/div.

0:20 We'll go ahead and read that directory and find all of the directories inside of there. Let's pop those directories into an arg. We'll call this open project, then pass in our ders. Then run open project again. You can see a list of the projects I currently have in my dev directory.

0:44 I can obviously type in filter down to select the project that I want. To provide a bit more information, we can map on this so that the choice is an object with a name of der and a description of home dev der.

1:01 That way, when we run this, you'll see the full path beneath that, which would definitely help if we're scanning multiple directories. We're also going to add the value here. If you don't add the value, it'll pass back the entire object.

1:15 We will add the value of that home dev der so that once you hit Enter, the value that comes out of our would be the selected der. Then we just have to pass selected der into edit. We'll say, edit selected der. It's saved there, and open project.

1:33 We'll go ahead and open electron builder. You can see it fires open my selected editor with the directory we selected.