2015-08-03 13:09:07 +01:00
|
|
|
require "formula"
|
|
|
|
require "tab"
|
2016-01-04 23:14:58 +01:00
|
|
|
require "diagnostic"
|
2019-04-17 18:25:08 +09:00
|
|
|
require "cli/parser"
|
2012-06-11 12:57:51 -07:00
|
|
|
|
2014-06-18 22:41:47 -05:00
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2018-11-05 12:53:16 +05:30
|
|
|
def missing_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
|
|
|
usage_banner <<~EOS
|
2019-01-30 21:32:35 +00:00
|
|
|
`missing` [<options>] [<formule>]
|
2018-11-05 12:53:16 +05:30
|
|
|
|
2019-01-30 21:32:35 +00:00
|
|
|
Check the given <formula> for missing dependencies. If no <formula> are
|
2018-11-05 12:53:16 +05:30
|
|
|
given, check all installed brews.
|
|
|
|
|
|
|
|
`missing` exits with a non-zero status if any formulae are missing dependencies.
|
|
|
|
EOS
|
|
|
|
comma_array "--hide",
|
|
|
|
description: "Act as if none of the provided <hidden> are installed. <hidden> should be "\
|
|
|
|
"comma-separated list of formulae."
|
|
|
|
switch :verbose
|
|
|
|
switch :debug
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-11 12:57:51 -07:00
|
|
|
def missing
|
2018-11-05 12:53:16 +05:30
|
|
|
missing_args.parse
|
2012-06-11 12:57:51 -07:00
|
|
|
return unless HOMEBREW_CELLAR.exist?
|
|
|
|
|
2012-08-14 11:57:10 -05:00
|
|
|
ff = if ARGV.named.empty?
|
2017-10-14 06:18:09 +01:00
|
|
|
Formula.installed.sort
|
2012-06-11 12:57:51 -07:00
|
|
|
else
|
2017-10-14 06:18:09 +01:00
|
|
|
ARGV.resolved_formulae.sort
|
2012-06-11 12:57:51 -07:00
|
|
|
end
|
|
|
|
|
2016-10-05 21:14:43 +01:00
|
|
|
ff.each do |f|
|
2018-11-05 12:53:16 +05:30
|
|
|
missing = f.missing_dependencies(hide: args.hide)
|
2016-10-05 21:14:43 +01:00
|
|
|
next if missing.empty?
|
|
|
|
|
2018-04-12 22:35:51 -07:00
|
|
|
Homebrew.failed = true
|
2016-10-05 21:14:43 +01:00
|
|
|
print "#{f}: " if ff.size > 1
|
2016-10-22 13:32:46 +01:00
|
|
|
puts missing.join(" ")
|
2012-06-11 12:57:51 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|