Port Homebrew::Cmd::Doctor
This commit is contained in:
parent
67fd065e1d
commit
f83ba58f8d
@ -1,14 +1,14 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
require "cli/parser"
|
|
||||||
require "cask/caskroom"
|
require "cask/caskroom"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
sig { returns(CLI::Parser) }
|
module Cmd
|
||||||
def self.doctor_args
|
class Doctor < AbstractCommand
|
||||||
Homebrew::CLI::Parser.new do
|
cmd_args do
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Check your system for potential problems. Will exit with a non-zero status
|
Check your system for potential problems. Will exit with a non-zero status
|
||||||
if any potential problems are found.
|
if any potential problems are found.
|
||||||
@ -25,12 +25,10 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :diagnostic_check
|
named_args :diagnostic_check
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def self.doctor
|
sig { override.void }
|
||||||
args = doctor_args.parse
|
def run
|
||||||
|
Homebrew.inject_dump_stats!(Diagnostic::Checks, /^check_*/) if args.audit_debug?
|
||||||
inject_dump_stats!(Diagnostic::Checks, /^check_*/) if args.audit_debug?
|
|
||||||
|
|
||||||
checks = Diagnostic::Checks.new(verbose: args.verbose?)
|
checks = Diagnostic::Checks.new(verbose: args.verbose?)
|
||||||
|
|
||||||
@ -77,4 +75,6 @@ module Homebrew
|
|||||||
|
|
||||||
puts "Your system is ready to brew." if !Homebrew.failed? && !args.quiet?
|
puts "Your system is ready to brew." if !Homebrew.failed? && !args.quiet?
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cmd/doctor"
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
RSpec.describe "brew doctor" do
|
RSpec.describe Homebrew::Cmd::Doctor do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
specify "check_integration_test", :integration_test do
|
specify "check_integration_test", :integration_test do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user