Merge pull request #15445 from binury/master

Add brew deps `--missing` arg
This commit is contained in:
Mike McQuaid 2023-05-18 15:08:48 +01:00 committed by GitHub
commit 1d794cd8c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -49,6 +49,8 @@ module Homebrew
switch "--installed",
description: "List dependencies for formulae that are currently installed. If <formula> is " \
"specified, list only its dependencies that are currently installed."
switch "--missing",
description: "Show only missing dependencies."
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", "--missing"
conflicts "--installed", "--eval-all"
conflicts "--installed", "--all"
conflicts "--formula", "--cask"

View File

@ -27,6 +27,8 @@ module Homebrew
description: "Resolve more than one level of dependencies."
switch "--installed",
description: "Only list formulae and casks that are currently installed."
switch "--missing",
description: "Only list formulae and casks that are not currently installed."
switch "--eval-all",
description: "Evaluate all available formulae and casks, whether installed or not, to show " \
"their dependents."
@ -47,6 +49,7 @@ module Homebrew
conflicts "--formula", "--cask"
conflicts "--installed", "--all"
conflicts "--missing", "--installed"
named_args :formula, min: 1
end

View File

@ -30,6 +30,7 @@ module DependenciesHelpers
end
ignores << "recommended?" if args.skip_recommended?
ignores << "satisfied?" if args.missing?
[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

View File

@ -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