- Created by Alexander Celeste, [email protected]
- February 2020
- Version 3
The lbf.fish
script can be called while in a folder that is part of a Local site to run any local-cli
command using that site's ID.
First link ln -s
the lbf.fish
script to lbf
in the folder above this repo, which is intended to be somewhere that is in your shell's PATH to make it easier to run. You will also need to chmod +x
the symlink to get it to run in the command line. Then simply use lbf
to run anything that you'd run with local-cli
.
In version 3 we started using jq
instead of the PHP script to retrieve data from the
Along with passing through commands to local-cli
, this script also adds the following:
restart
will restart a siteopen
will open the site in your default browser
You can configure VS Code to run these commands using the tasks.json
file in .vscode
or a Workspace (which the below example is of). This can enable easy access to controlling a Local from its associated VS Code environment.
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Start Site",
"group": "none",
"type": "shell",
"runOptions": {
"runOn": "folderOpen"
},
"command": "lbf start-site",
"presentation": {
"reveal": "never",
"focus": false,
"echo": true,
"panel": "dedicated",
"clear": false,
"group": "server"
},
"problemMatcher": []
}
]
},
Any feedback is welcome. Feel free to submit issues on the Github repository.
lbf-container.php
takes input of two paths (if called from lbf.fish
this will be the current working directory and your home directory) and returns the info asked for in the third argument from the first path passed in. It finds the requested data by parsing Local's own sites.json
file that lives within your user's library (hence why it needs your home directory). This script is really designed only to be run from lbf.fish
. I wrote this part in PHP because I was more comfortable parsing JSON in PHP than Fish.
This project started out life with classic Local as a way to drop into the Docker container's shell. Since version 5, that is no longer needed, but now that local-cli
is around the same underlying script can be used to simplify running those commands without needing to pass a site ID. The old version can still be seen in Git commit history. The script still uses lbf as a shorter command name, and tribute to the original name Local by Flywheel.