Port Homebrew::Cmd::Readall
This commit is contained in:
parent
5ef070380c
commit
057f561d2c
@ -1,16 +1,14 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
require "readall"
|
require "readall"
|
||||||
require "cli/parser"
|
|
||||||
require "env_config"
|
require "env_config"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module Cmd
|
||||||
|
class ReadallCmd < AbstractCommand
|
||||||
sig { returns(CLI::Parser) }
|
cmd_args do
|
||||||
def readall_args
|
|
||||||
Homebrew::CLI::Parser.new do
|
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Import all items from the specified <tap>, or from all installed taps if none is provided.
|
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
|
This can be useful for debugging issues across all items when making
|
||||||
@ -33,11 +31,9 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :tap
|
named_args :tap
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def readall
|
|
||||||
args = readall_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
Homebrew.with_no_api_env do
|
Homebrew.with_no_api_env do
|
||||||
if args.syntax? && args.no_named?
|
if args.syntax? && args.no_named?
|
||||||
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
|
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
|
||||||
@ -68,3 +64,5 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
module Readall
|
module Readall
|
||||||
class << self
|
class << self
|
||||||
|
undef valid_casks?
|
||||||
|
|
||||||
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type)
|
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type)
|
||||||
return true if os_name == :linux
|
return true if os_name == :linux
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cmd/readall"
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
RSpec.describe "brew readall" do
|
RSpec.describe Homebrew::Cmd::ReadallCmd do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
it "imports all Formulae for a given Tap", :integration_test do
|
it "imports all Formulae for a given Tap", :integration_test do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user