ohmyzsh/plugins/bem/bem.plugin.zsh
2012-09-25 05:34:07 +04:00

33 lines
778 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Completion for bem command
# Автодополнение для команды bem
eval "$(bem completion 2> /dev/null)"
# If we have bem in our project run them, otherwise run global bem
# Если у нас есть установленный bem в папке с проектом, то запустим его
# иначе - глобальный bem
whichBem() {
bemPath="$1/node_modules/.bin/bem"
if [ -f ${bemPath} ]
then
echo ${bemPath}
else
if [ $1='/' ]
then
echo $(which bem)
else
parent=$(dirname $1)
echo $(whichBem $parent)
fi
fi
}
bem() {
bemCmd=$(whichBem $PWD)
if [ -f ${bemCmd} ]
then
bemCmd="${bemCmd} $@"
eval ${bemCmd}
fi
}