Created
November 12, 2019 21:07
-
-
Save molotovbliss/3eb18a2b0366d9b9e15647322641816d to your computer and use it in GitHub Desktop.
Warden command for xdebug from CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1 | |
source "${WARDEN_DIR}/utils/env.sh" | |
WARDEN_ENV_PATH="$(locateEnvPath)" || exit $? | |
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $? | |
pushd "${WARDEN_DIR}" >/dev/null | |
# docker exec -ti <CONTAINER_ID> php -d xdebug.remote_autostart=on -d xdebug.remote_host=host.docker.internal bin/magento | |
containerid=$(docker ps -qf "name=debug") | |
#echo $containerid; | |
if [[ $containerid != "" ]]; then | |
echo "xDebug executing on container ... ${WARDEN_PARAMS[0]}"; | |
docker exec -ti $containerid php -d xdebug.remote_autostart=on -d xdebug.remote_host=host.docker.internal "${WARDEN_PARAMS[@]}" "$@" | |
else | |
echo "A container image named 'debug' was not found."; | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save above file to /usr/local/Cellar/warden/[x.x.x]/commands/clixdebug.cmd (replacing [x.x.x] with version) | |
Usage: | |
`warden clixdebug <php-script-file>` | |
NOTE: full path not needed. | |
Example how-to execute via warden: | |
`warden clixdebug bin/magento` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@chapagain Thanks for the update! Glad to hear it's included in warden out of box now. Cheers! 👍