2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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-08-06 14:17:17 -04:00
|
|
|
`missing` [<options>] [<formula>]
|
2018-11-05 12:53:16 +05:30
|
|
|
|
2019-08-20 00:04:14 -04:00
|
|
|
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",
|
2019-08-20 00:04:14 -04: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."
|
2018-11-05 12:53:16 +05:30
|
|
|
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
|