module Minitest

def self.plugin_line_init(options)

def self.plugin_line_init(options)
  unless exp_line = options[:line]
    reporter.reporters << LineReporter.new
    return
  end
  tests = Minitest::Line.tests_with_lines
  filter, _ = tests.sort_by { |n, l| -l }.detect { |n, l| exp_line >= l }
  raise "Could not find test method before line #{exp_line}" unless filter
  options[:filter] = filter
end

def self.plugin_line_inject_reporter

def self.plugin_line_inject_reporter
end

def self.plugin_line_options(opts, options)

def self.plugin_line_options(opts, options)
  opts.on '-l', '--line N', Integer, "Run test at line number" do |lineno|
    options[:line] = lineno
  end
end

def self.plugin_rg_init options # :nodoc:

:nodoc:
def self.plugin_rg_init options # :nodoc:
  if RG.rg?
    io = RG.new options[:io]
    reporter.reporters.grep(Minitest::Reporter).each do |rep|
      rep.io = io
    end
  end
end

def self.plugin_rg_options opts, _options # :nodoc:

:nodoc:
def self.plugin_rg_options opts, _options # :nodoc:
  opts.on "--[no-]rg", "Add red/green to test output." do |bool|
    RG.rg! bool
  end
end