New CLI helper tool

I do much of my work from the commandline, so wanted a simple way to run things from an existing shell rather than opening a new terminal from the Local GUI.

I put together a quick hack that’ll open a shell, run wp-cli, run a mysql client or some other things against an instance of Local with minimal effort.

Mac only, right now, but a Windows version would be pretty simple (and I’ll put one together when I have a spare hour if I’ve not had a pull request for one by then).

It doesn’t require any installation or configuration, just download and unzip the binary and put it somewhere in your path. “lfw help” will show the documentation such as it is. “lfw shell” will open a shell on your current Local instance, "lfw wp " will run wp-cli and so on.

It uses some simple heuristics to work out which site to connect to: If you only have one running, it’ll connect to that site. If you’re in the directory of a site in “~/Local Sites” it’ll connect to that one. Otherwise you can specify which site to connect to with --site= or the LFW_SITE environment variable.


I’ve independently created a similar tool :slight_smile: Great minds think alike.

What I am still looking for is a way to start/stop/restart a site from the command line.
Could be done with AppleScript, but the Local app does not support it.

If anyone knows a way to do this, I’d be very happy to hear it :slight_smile:

Holy post revival, batman! I’m wondering if in the past two years anyone has gotten this to work. I’m trying to create some automation using Alfred and it would be great to spin up a site. Any thoughts?