diff --git a/.functions.sh b/.functions.sh index 08a97f6..ca934d8 100644 --- a/.functions.sh +++ b/.functions.sh @@ -94,4 +94,18 @@ port() { port=$((min_port + (sum % port_range))) echo $port +} + +# Prevent brew upgrade commands +brew() { + local command="$1" + shift + + if [[ "$command" == "upgrade" ]] || [[ "$command" == "update" && "$*" == *"--greedy"* ]] || [[ "$command" == "update" && "$*" == *"upgrade"* ]]; then + echo "⛔️ BREW UPGRADE BLOCKED: This command has been disabled to prevent breaking your system, it will break Postgres & Meilisearch and you will waste a lot of time fixing them." + echo "If you really need to upgrade packages, use 'command brew $command $*' to bypass this protection." + return 1 + else + command brew "$command" "$@" + fi } \ No newline at end of file