Merge pull request #8158 from SeekingMeaning/uses/tree-part-0
cmd/uses: extract function `intersection_of_dependents`
This commit is contained in:
commit
ec9589b048
@ -65,15 +65,25 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
use_runtime_dependents = args.installed? &&
|
use_runtime_dependents = args.installed? &&
|
||||||
|
!used_formulae_missing &&
|
||||||
!args.include_build? &&
|
!args.include_build? &&
|
||||||
!args.include_test? &&
|
!args.include_test? &&
|
||||||
!args.include_optional? &&
|
!args.include_optional? &&
|
||||||
!args.skip_recommended?
|
!args.skip_recommended?
|
||||||
|
|
||||||
|
uses = intersection_of_dependents(use_runtime_dependents, used_formulae, args: args)
|
||||||
|
|
||||||
|
return if uses.empty?
|
||||||
|
|
||||||
|
puts Formatter.columns(uses.map(&:full_name).sort)
|
||||||
|
odie "Missing formulae should not have dependents!" if used_formulae_missing
|
||||||
|
end
|
||||||
|
|
||||||
|
def intersection_of_dependents(use_runtime_dependents, used_formulae, args:)
|
||||||
recursive = args.recursive?
|
recursive = args.recursive?
|
||||||
includes, ignores = args_includes_ignores(args)
|
includes, ignores = args_includes_ignores(args)
|
||||||
|
|
||||||
uses = if use_runtime_dependents && !used_formulae_missing
|
if use_runtime_dependents
|
||||||
used_formulae.map(&:runtime_installed_formula_dependents)
|
used_formulae.map(&:runtime_installed_formula_dependents)
|
||||||
.reduce(&:&)
|
.reduce(&:&)
|
||||||
.select(&:any_version_installed?) +
|
.select(&:any_version_installed?) +
|
||||||
@ -87,11 +97,6 @@ module Homebrew
|
|||||||
|
|
||||||
select_used_dependents(deps, used_formulae, recursive, includes, ignores)
|
select_used_dependents(deps, used_formulae, recursive, includes, ignores)
|
||||||
end
|
end
|
||||||
|
|
||||||
return if uses.empty?
|
|
||||||
|
|
||||||
puts Formatter.columns(uses.map(&:full_name).sort)
|
|
||||||
odie "Missing formulae should not have dependents!" if used_formulae_missing
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_used_dependents(dependents, used_formulae, recursive, includes, ignores)
|
def select_used_dependents(dependents, used_formulae, recursive, includes, ignores)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user