From ee0e9945e0f1a690471cca570ed005694d7ca6d8 Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 8 Jul 2020 12:43:24 -0400 Subject: [PATCH] outdated: Update logic when handling --json to be more explicit --- Library/Homebrew/cmd/outdated.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 2573434eff..3150f1d444 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -48,9 +48,14 @@ module Homebrew if args.json raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json + + # When user asks for json, print json for formula only unless the user explicitly asks for casks + formula_only = !args.cask_only? + else + formula_only = args.formula_only? end - if args.formula_only? || !args.cask_only? && args.json + if formula_only formulae = args.resolved_formulae.blank? ? Formula.installed : args.resolved_formulae outdated = print_outdated_formulae(formulae) elsif args.cask_only?