From 966131f7688576f52e3e3325bb07f63f11264e79 Mon Sep 17 00:00:00 2001 From: William Ma Date: Tue, 7 Jul 2020 09:37:36 -0400 Subject: [PATCH] outdated: Fail when user supplies formulae and some are outdated --- Library/Homebrew/cmd/outdated.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 7d7dbabad6..2573434eff 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -24,8 +24,8 @@ module Homebrew flag "--json", description: "Print output in JSON format. Currently the default and only accepted "\ "value for is `v1`. See the docs for examples of using the JSON "\ - "output: ."\ - "By default, this option treats all arguments as formulae."\ + "output: . "\ + "By default, this option treats all arguments as formulae. "\ "To treat arguments as casks, use the --cask-only option." switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ @@ -53,13 +53,9 @@ module Homebrew if args.formula_only? || !args.cask_only? && args.json formulae = args.resolved_formulae.blank? ? Formula.installed : args.resolved_formulae outdated = print_outdated_formulae(formulae) - - Homebrew.failed = !formulae.blank? && !outdated.blank? elsif args.cask_only? casks = args.named.blank? ? Cask::Caskroom.casks : args.named outdated = print_outdated_casks(casks) - - Homebrew.failed = !casks.blank? && !outdated.blank? else formulae, casks = args.resolved_formulae_casks @@ -68,11 +64,10 @@ module Homebrew casks = Cask::Caskroom.casks end - outdated_formulae = print_outdated_formulae(formulae) - outdated_casks = print_outdated_casks(casks) - - Homebrew.failed = !formulae.blank? && !outdated_formulae.blank? || !casks.blank? && !outdated_casks.blank? + outdated = print_outdated_formulae(formulae) + print_outdated_casks(casks) end + + Homebrew.failed = args.named.present? && outdated.present? end def print_outdated_formulae(formulae)