2016-10-10 13:41:27 +01:00
|
|
|
#: * `missing` [`--hide=`<hidden>] [<formulae>]:
|
2016-08-17 01:19:40 +02:00
|
|
|
#: Check the given <formulae> for missing dependencies. If no <formulae> are
|
|
|
|
#: given, check all installed brews.
|
2016-10-10 13:41:27 +01:00
|
|
|
#:
|
|
|
|
#: If `--hide=`<hidden> is passed, act as if none of <hidden> are installed.
|
2016-10-30 16:30:40 +00:00
|
|
|
#: <hidden> should be a comma-separated list of formulae.
|
2018-04-12 22:35:51 -07:00
|
|
|
#:
|
|
|
|
#: `missing` exits with a non-zero status if any formulae are missing dependencies.
|
2016-04-08 16:28:43 +02:00
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
require "formula"
|
|
|
|
require "tab"
|
2016-01-04 23:14:58 +01:00
|
|
|
require "diagnostic"
|
2018-11-05 12:53:16 +05:30
|
|
|
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
|
|
|
|
`missing` [<options>] [<formulae>]
|
|
|
|
|
|
|
|
Check the given <formulae> for missing dependencies. If no <formulae> are
|
|
|
|
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
|