Merge pull request #5250 from GauthamGoli/missing-args
missing: Use CLI::Parser to parse args
This commit is contained in:
commit
bd38ccb9fd
@ -10,11 +10,31 @@
|
|||||||
require "formula"
|
require "formula"
|
||||||
require "tab"
|
require "tab"
|
||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
|
require "cli_parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
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
|
def missing
|
||||||
|
missing_args.parse
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
ff = if ARGV.named.empty?
|
ff = if ARGV.named.empty?
|
||||||
@ -24,7 +44,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
ff.each do |f|
|
ff.each do |f|
|
||||||
missing = f.missing_dependencies(hide: ARGV.values("hide"))
|
missing = f.missing_dependencies(hide: args.hide)
|
||||||
next if missing.empty?
|
next if missing.empty?
|
||||||
|
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user