Local (by Flywheel) is great, but for a terminal type of person as I am, I find it way more convenient to SSH into a VM and use the WP-CLI to perform WordPress tasks. With a platform like Vagrant, one has the
vagrant ssh
With Local, you can do this with the push of a button in Local, but as said, I like the terminal better.
lbf ssh
But wait, there is much more ;)
The lbf command can do the following, from within a directory controlled by Local (for instance ~/Local Sites/mywebsite/app/public)
lbf list | List all sites |
lbf raw | View all info Local has on this site |
lbf open | Open the site in your default browser |
lbf mailhog | Open the mailhog software for this site in your default browser |
lbf db | Open Sequel Pro with the database of this site |
lbf ssh [optional: command line] | Open the docker shell of this site, or execute the command line inside the docker shell |
lbf wp commands | Perform WP-CLI operation on site |
lbf wpdr | Perform wp search-replace <current domain> <local domain> |
You can use --site, --project or -p to specify a site, either by Name, ID or Path to operate on
You can use --browser or -b to specify a WebBrowser either by AppName or AppPath to use for ‘open’ and ‘mailhog’
You can use --ssl to use https with operation ‘open’ and ‘wpdr’
You can use browser shortcuts;
-ff --firefox |
Firefox |
-fd --firefox-dev --firefox-developer-edition |
Firefox Developer Edition |
-c --chrome |
Chrome |
-cd --chrome-dev --chromium |
Chromium |
-o --opera |
Opera |
-s --safari |
Safari |
Of course, the browser of choice must be installed… Duh…
So, now you can do this: (while inside the app folder)
lbf db
lbf wpdr
lbf wp plugin install --activate wordpress-seo classic-editor duplicate-post what-the-file wp-smushit
I would hope to one day add the following commands:
lbf start|stop|restart | Start, Stop or Restart the site |
lbf vm start|stop|restart | Start, Stop or Restart the Local VM |
lbf app start|stop|restart | Start, Stop or Restart the entire Local ecosystem |
The last one, while technically already possible, is not yet useful until the site and vm start/stop/restart options are functional.
Enjoy, but as always; at your own risk :)
One thought on “Handy script: lbf”