From 433a09d79842953ed9d26c0af6e71ec64374cb25 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 5 Nov 2018 12:53:16 +0530 Subject: [PATCH] missing: Use CLI::Parser to parse args --- Library/Homebrew/cmd/missing.rb | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index a12fd5460e..224c525bcc 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -10,11 +10,31 @@ require "formula" require "tab" require "diagnostic" +require "cli_parser" module Homebrew module_function + def missing_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `missing` [] [] + + Check the given for missing dependencies. If no 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 are installed. should be "\ + "comma-separated list of formulae." + switch :verbose + switch :debug + end + end + def missing + missing_args.parse return unless HOMEBREW_CELLAR.exist? ff = if ARGV.named.empty? @@ -24,7 +44,7 @@ module Homebrew end ff.each do |f| - missing = f.missing_dependencies(hide: ARGV.values("hide")) + missing = f.missing_dependencies(hide: args.hide) next if missing.empty? Homebrew.failed = true