Last active
March 20, 2023 19:20
-
-
Save davidalger/bdfad83558313b283ff1 to your computer and use it in GitHub Desktop.
Magento 2 Shell Wrapper
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 | |
# usage: put at /usr/local/bin/magento then call from anywhere within a magento 2 webroot | |
# | |
dir="$(pwd)" | |
while [[ "$dir" != "/" ]]; do | |
if [[ -x "$dir/bin/magento" ]]; then | |
"$dir/bin/magento" "$@" | |
exit $? | |
fi | |
dir="$(dirname "$dir")" | |
done | |
>&2 echo "Error: Failed to locate bin/magento (you probably are not inside a magento site root)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment