Port Homebrew::Cmd::Missing

This commit is contained in:
Douglas Eichelberger 2024-03-31 19:49:25 -07:00
parent 0cb608a80c
commit a43224cb4a
2 changed files with 33 additions and 34 deletions

View File

@ -1,17 +1,15 @@
# typed: true
# typed: strict
# frozen_string_literal: true
require "abstract_command"
require "formula"
require "tab"
require "diagnostic"
require "cli/parser"
module Homebrew
module_function
sig { returns(CLI::Parser) }
def missing_args
Homebrew::CLI::Parser.new do
module Cmd
class Missing < AbstractCommand
cmd_args do
description <<~EOS
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
@ -23,11 +21,9 @@ module Homebrew
named_args :formula
end
end
def missing
args = missing_args.parse
sig { override.void }
def run
return unless HOMEBREW_CELLAR.exist?
ff = if args.no_named?
@ -45,4 +41,6 @@ module Homebrew
puts missing.join(" ")
end
end
end
end
end

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
require "cmd/missing"
require "cmd/shared_examples/args_parse"
RSpec.describe "brew missing" do
RSpec.describe Homebrew::Cmd::Missing do
it_behaves_like "parseable arguments"
it "prints missing dependencies", :integration_test do