After reading Be Lazy I came up with this question: could I write a Terminal function that loads projects environments?
First, I had to find out if writting custom commands was even possible. And yes, it is. I got some information from this article.
What I want my command to do:
- Go to the project directory in the Terminal
- Open the project files in Espresso (my text editor)
- Go to localhost on the browser (Safari)
- Launch MAMP
In less than a minute, I had a function running to do this. Now I just have to launch Terminal and type
load my-project and there it is, everything I need to work on my project.
Here’s the function:
open -a espresso $1.esproj
open -a mamp
open -a safari http://localhost:8888
If you want to use this or create your own, simply launch the Terminal, open
.bash_profile on your text editor, and paste this function somewhere. Of course, you should write your own project routes and change
"safari" to the actual apps you use. Also, my li’l function assumes that your project directory and your Espresso project are named the same. But well, you already noticed this, didn’t you?