brew/Library/Homebrew/cmd/missing.rb

49 lines
1.1 KiB
Ruby
Raw Normal View History

2020-11-25 17:03:23 +01:00
# typed: true
# frozen_string_literal: true
require "formula"
require "tab"
require "diagnostic"
2019-04-17 18:25:08 +09:00
require "cli/parser"
module Homebrew
2016-09-26 01:44:51 +02:00
module_function
2020-10-20 12:03:48 +02:00
sig { returns(CLI::Parser) }
2018-11-05 12:53:16 +05:30
def missing_args
Homebrew::CLI::Parser.new do
description <<~EOS
Check the given <formula> kegs for missing dependencies. If no <formula> are
provided, check all kegs. Will exit with a non-zero status if any kegs are found
to be missing dependencies.
2018-11-05 12:53:16 +05:30
EOS
comma_array "--hide",
2022-06-28 10:09:59 +01:00
description: "Act as if none of the specified <hidden> are installed. <hidden> should be " \
2019-08-06 14:22:24 -04:00
"a comma-separated list of formulae."
2021-01-10 14:26:40 -05:00
named_args :formula
2018-11-05 12:53:16 +05:30
end
end
def missing
2020-07-30 18:40:10 +02:00
args = missing_args.parse
return unless HOMEBREW_CELLAR.exist?
ff = if args.no_named?
Formula.installed.sort
else
args.named.to_resolved_formulae.sort
end
ff.each do |f|
2018-11-05 12:53:16 +05:30
missing = f.missing_dependencies(hide: args.hide)
next if missing.empty?
Homebrew.failed = true
print "#{f}: " if ff.size > 1
puts missing.join(" ")
end
end
end