SET_DEBUG_MODE 696 Bytes
#!/usr/bin/env bash

config_file="config/app.php"

function usage {
	echo
	echo "Usage:"
	echo "$0 ON/OFF"
	echo "- ON : set general debug mode ON"
	echo "- OFF : set general debug mode OFF"
	echo
}

[[ $1 != "ON" && $1 != "OFF" ]] && usage && exit

if [[ $1 == "OFF" ]] ; then
	# OFF
	CURRENT_VAL="true"
	NEW_VAL="false"
else
	# ON
	CURRENT_VAL="false"
	NEW_VAL="true"
fi

sed -e "s/'debug' => filter_var(env('DEBUG', $CURRENT_VAL)/'debug' => filter_var(env('DEBUG', $NEW_VAL)/" -i $config_file

# For Mac OS => replace -i with -i ''
#sed -e "s/'debug' => filter_var(env('DEBUG', $CURRENT_VAL)/'debug' => filter_var(env('DEBUG', $NEW_VAL)/" -i '' $config_file

echo
echo "DEBUG MODE is $1"
echo