Last active
August 13, 2018 16:40
-
-
Save samtay/6086149b103e4bbe3ceededb6da0ed27 to your computer and use it in GitHub Desktop.
Auto completion & portability for bin/magento
This file contains 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
# ------------------------------------------------------------------------------ | |
# FILE: m2.plugin.zsh | |
# DESCRIPTION: oh-my-zsh m2 autocomplete file. Adapted from composer plugin | |
# AUTHOR: Sam Tay ([email protected]) | |
# VERSION: 1.0.0 | |
# ------------------------------------------------------------------------------ | |
# Keep this up to date by checking bin-magento list --raw --no-ansi | |
_bin_magento_get_command_list () { | |
bin-magento --raw --no-ansi list | sed "s/[[:space:]].*//g" | |
} | |
_bin_magento () { | |
compadd $(_bin_magento_get_command_list) | |
} | |
compdef _bin_magento bin-magento |
This file contains 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
# Get magento webroot | |
function get-magento-root() { | |
local magentopath=`git rev-parse --show-toplevel`; | |
if [ -d "$magentopath/webroot" ]; then | |
magentopath="$magentopath/webroot" | |
fi | |
echo $magentopath; | |
} | |
# bin/magento from anywhere in git root | |
function bin-magento(){ | |
php $(get-magento-root)/bin/magento -vvv "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment