A large part of my work these days is writing plugins and themes for WordPress. I use a tool called Local by Flywheel to run copies of client sites, and other experimental sandbox sites, for development purposes locally on my Mac. That way I can mess around as much as I need to without compromising the actual websites. Local has a somewhat unintuitive feature to open a (fake, since it is just Docker containers) SSH connection to the sites it runs locally. You access it from the contextual menu of sites in the main window. This gets old fast when you have a dozen or more windows open on your desktop, and it may be that Local is even in another desktop space altogether, behind yet more windows. That is just the reality of software/web development, lots of windows, regardless how organized you are. Usually up front in my development environments is my code editor, and most advanced code editors these days (including the one I use for web development, Visual Studio Code) have integrated terminals in their single window per project interfaces. So, all in all, digging around for a window just to launch a different Terminal and copy the command it runs to enter the Local site’s “SSH” in the integrated terminal was getting really annoying.
So, I thought it could be done better. Between last night and this morning I’ve put together my response to this inconvieient arrangement, LBF Container. This shell script can be called from any folder that is part of a Local site and it will drop you right into that site’s bash prompt. No getting lost trying to find Local’s window. No leaving your work environment whatsoever, in fact. It is somewhat blissfull being able to just type a simple command in the integrated terminal and end up with the same thing that used to take a few steps and digging around my Mac. I thought that others may be interested in this script as well, which is why I provide you with access to it. Let me know if this is useful to you, I’d love to hear your feedback.