Please help! I have been trying to use WP-CLI in my Visual Studio Code while Local by Flywheel is open with the bash terminal, but it seems that I can only work from the local terminal. I want to use Visual Studio Code instead.
I use macOS but the principle should be the same. You have to find the shell script that sets the environment variables and starts the shell for the website in question. In macOS you will find the shell scripts for the Local websites in the users Application Support
folder. You can start the shell by enter the path to the shell script but I have created an alias in the bash profile for each website to quickly start a terminal session in VS Code.
/Users/USERNAME/Library/Application\ Support/Local/ssh-entry/QtMpqLkVF.sh
alias website.sh="/Users/USERNAME/Library/Application\ Support/Local/ssh-entry/QtMpqLkVF.sh"
@emmtre 's solution is cool! Another option that we’ve thought about implementing in Local core is to use direnv.
You can still use direnv with Local (and any terminal, including VS Code) today with an addon!
Clay, the original author of Local (Pressmatic) created this addon which adds the .envrc
needed for direnv to the <site>/app/
folder.
You can download that addon and install it from “Addons > Installed > Install from disk” in Local:
This is absolutely awesome! It worked perfectly. Thank you so much!
Many thanks for the info. Sounds like a good idea I think. I had no idea this plugin even existed. I’ll have to test when I have the chance.
“This is also great. Thank you so much.”