brew/Library/Homebrew/cmd/missing.rb

49 lines
1.1 KiB
Ruby
Raw Normal View History

# 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
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
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",
2019-04-30 08:44:35 +01:00
description: "Act as if none of the provided <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
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