switch-php icon indicating copy to clipboard operation
switch-php copied to clipboard

Check if Brew is installed

Open lesaff opened this issue 6 years ago • 3 comments

I have Brew installed already so all good, but I think it would be nice to check for Brew in case user forgot that he/she does not have Brew installed.

Something like this perhaps?

command -v brew >/dev/null 2>&1 || { echo >&2 "Installing Homebrew Now"; \
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"; }

Source: https://gist.github.com/ryanmaclean/4094dfdbb13e43656c3d41eccdceae05

lesaff avatar Mar 23 '18 18:03 lesaff

@lesaff good call! I'm not sure though that I want it to actually perform the installation. I'd rather just let them know that switch-php requires Brew and maybe recommend the necessary commands to run.

I personally think installing Brew (or anything for that matter) without asking for the user's permission is a little unethical. But I can definitely add in a clause that if Brew isn't installed, throw an error that also includes the necessary commands to install Brew so they can copy/paste/run if they so desire.

Thanks for the first issue! 😜

jalendport avatar Mar 23 '18 18:03 jalendport

Maybe just return Brew is not installed message to remind user? 💭

lesaff avatar Mar 23 '18 18:03 lesaff

Yep something along those lines sounds like the best idea 👍

jalendport avatar Mar 23 '18 18:03 jalendport