mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
composer: Fix bin directory when Composer is not available (#6240)
* Fix for Composer's bin when Composer isn't global When Composer isn't globally installed, the `composer global` call results in an error. This checks to see if Composer is available before making the call. When Composer isn't available, it will just manually set the directories. * Fix Composer brackets in global bin directory * composer: Apply feedback from ricpelo This applies ricpelo's feedback at https://github.com/robbyrussell/oh-my-zsh/pull/6240#pullrequestreview-64253321 * composer: Fix path check syntax * composer: test with $commands[] syntax
This commit is contained in:
parent
b743ce9224
commit
0de3b29fd3
1 changed files with 7 additions and 2 deletions
|
@ -51,5 +51,10 @@ alias cgrm='composer global remove'
|
||||||
# install composer in the current directory
|
# install composer in the current directory
|
||||||
alias cget='curl -s https://getcomposer.org/installer | php'
|
alias cget='curl -s https://getcomposer.org/installer | php'
|
||||||
|
|
||||||
# Add Composer's global binaries to PATH
|
# Add Composer's global binaries to PATH, using Composer if available.
|
||||||
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
|
if (( $+commands[composer] )); then
|
||||||
|
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
|
||||||
|
else
|
||||||
|
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
|
||||||
|
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue