Port Homebrew::Cmd::Readall

This commit is contained in:
Douglas Eichelberger 2024-04-01 10:05:02 -07:00
parent 5ef070380c
commit 057f561d2c
3 changed files with 57 additions and 56 deletions

View File

@ -1,16 +1,14 @@
# typed: true
# typed: strict
# frozen_string_literal: true
require "abstract_command"
require "readall"
require "cli/parser"
require "env_config"
module Homebrew
module_function
sig { returns(CLI::Parser) }
def readall_args
Homebrew::CLI::Parser.new do
module Cmd
class ReadallCmd < AbstractCommand
cmd_args do
description <<~EOS
Import all items from the specified <tap>, or from all installed taps if none is provided.
This can be useful for debugging issues across all items when making
@ -33,11 +31,9 @@ module Homebrew
named_args :tap
end
end
def readall
args = readall_args.parse
sig { override.void }
def run
Homebrew.with_no_api_env do
if args.syntax? && args.no_named?
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
@ -67,4 +63,6 @@ module Homebrew
end
end
end
end
end
end

View File

@ -3,6 +3,8 @@
module Readall
class << self
undef valid_casks?
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type)
return true if os_name == :linux

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
require "cmd/readall"
require "cmd/shared_examples/args_parse"
RSpec.describe "brew readall" do
RSpec.describe Homebrew::Cmd::ReadallCmd do
it_behaves_like "parseable arguments"
it "imports all Formulae for a given Tap", :integration_test do