brew/Library/Homebrew/cmd/missing.rb

56 lines
1.5 KiB
Ruby
Raw Normal View History

2016-10-10 13:41:27 +01:00
#: * `missing` [`--hide=`<hidden>] [<formulae>]:
#: 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.
#:
#: `missing` exits with a non-zero status if any formulae are missing dependencies.
2016-04-08 16:28:43 +02:00
require "formula"
require "tab"
require "diagnostic"
2018-11-05 12:53:16 +05:30
require "cli_parser"
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
def missing
2018-11-05 12:53:16 +05:30
missing_args.parse
return unless HOMEBREW_CELLAR.exist?
ff = if ARGV.named.empty?
Formula.installed.sort
else
ARGV.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