diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 56a0db6dca..47c1dec6d7 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -49,6 +49,8 @@ module Homebrew switch "--installed", description: "List dependencies for formulae that are currently installed. If is " \ "specified, list only its dependencies that are currently installed." + switch "--skip-installed", + description: "Skip dependencies for formulae that are currently installed." switch "--eval-all", description: "Evaluate all available formulae and casks, whether installed or not, to list " \ "their dependencies." @@ -64,6 +66,7 @@ module Homebrew description: "Treat all named arguments as casks." conflicts "--tree", "--graph" + conflicts "--installed", "--skip-installed" conflicts "--installed", "--eval-all" conflicts "--installed", "--all" conflicts "--formula", "--cask" diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb index 4d5f1a312a..02965a446a 100644 --- a/Library/Homebrew/dependencies_helpers.rb +++ b/Library/Homebrew/dependencies_helpers.rb @@ -30,6 +30,7 @@ module DependenciesHelpers end ignores << "recommended?" if args.skip_recommended? + ignores << "satisfied?" if args.skip_installed? [includes, ignores] end @@ -44,6 +45,8 @@ module DependenciesHelpers klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) elsif dep.optional? klass.prune if includes.exclude?("optional?") && !dependent.build.with?(dep) + elsif dep.satisfied? + klass.prune if ignores.include?("satisfied?") elsif dep.build? || dep.test? keep = false keep ||= dep.test? && includes.include?("test?") && dependent == root_dependent diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 0879cf268e..8464d8aea7 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -48,7 +48,7 @@ class Dependency to_formula.latest_version_installed? end - def satisfied?(inherited_options) + def satisfied?(inherited_options = []) installed? && missing_options(inherited_options).empty? end