echo-in() { #args= color, text
  local NO_COLOR="\033[0m"
  echo "${1}${2}${NO_COLOR}"
}
echo-in-blue() { echo-in "\033[0;34m" $1}

brew-upgrades() {
  echo-in-blue "Upgrading brew"
  brew update
  brew upgrade --cleanup

  echo-in-blue "Upgrading mas"
  mas upgrade

  echo-in-blue "Upgrading brew cask"
  for outdated in "${(@f)$(brew cask outdated --quiet)}"
  do
    if [[ !  -z  $outdated  ]]
    then
      brew cask reinstall $outdated
    fi
  done

  echo "Cleanup"
  brew cleanup -s
  echo "Done!"
}

echo-in() { #args= color, text
  local NO_COLOR="\033[0m"
  echo "${1}${2}${NO_COLOR}"
}
echo-in-blue() { echo-in "\033[0;34m" $1}

brew-upgrades() {
  echo-in-blue "Upgrading brew"
  HOMEBREW_INSTALL_CLEANUP=true brew update

  echo-in-blue "Upgrading mas"
  mas upgrade

  echo-in-blue "Upgrading brew cask"
  for outdated in "${(@f)$(brew cask outdated --quiet)}"
  do
    if [[ !  -z  $outdated  ]]
    then
      brew cask reinstall $outdated
    fi
  done

  echo "Cleanup"
  brew cleanup -s
  echo "Done!"
}

Remove homebrew warning 'brew upgrade --cleanup' is deprecated!'
Remove homebrew warning 'brew upgrade --cleanup' is deprecated!'

Remove this warning with homebrew 1.9:

  Warning: Calling 'brew upgrade --cleanup' is deprecated! Use 'HOMEBREW_INSTALL_CLEANUP' instead.

See https://brew.sh/2019/01/09/homebrew-1.9.0/:
  brew upgrade --cleanup and HOMEBREW_UPGRADE_CLEANUP have been replaced with the HOMEBREW_INSTALL_CLEANUP variable. These will become default behaviours in 2.0.0.
