if [[ -r "$(brew --prefix)/opt/mcfly/mcfly.zsh" ]]; then
source "$(brew --prefix)/opt/mcfly/mcfly.zsh"
fi
Tip: hardcode brew --prefix. It's /usr/local for most people anyway. brew is written in Ruby so invocations are expensive; brew --prefix takes ~30ms on my systems so the above snippet adds ~60ms to shell startup which is a complete waste. Add a couple of frivolous snippets like this and you have people complaining about slow startup.
I’m saying they print what you should add. I’m not saying have an init command that you run on your shell script on startup. I’m saying have an init command that tell you what to put.
I think the hardcoded approach by smichel17 with a fallback is a good one. Except that if you ran this command, it might print a different hardcoded path based on where it found the prefix to be at.