module Maxitest::Testrbl

def run_from_cli(argv)

def run_from_cli(argv)
  files, options = partition_argv(argv)
  files.concat(changed_files) if options.delete("--changed")
  files = ["test"] if files.empty?
  files = files.map { |f| localize(f) }
  load_options, options = partition_options(options)
  if files.size == 1 and files.first =~ /^(\S+):(\d+)$/
    file = $1
    line = $2
    run(ruby + load_options + line_pattern_option(file, line) + options)
  else
    if files.size == 1 and File.file?(files.first)
      run(ruby + load_options + files + options)
    elsif options.none? { |arg| arg =~ /^-n/ }
      seed = if seed = options.index("--seed")
        ["--"] + options.slice!(seed, 2)
      else
        []
      end
      files = files.map { |f| File.directory?(f) ? all_test_files_in(f) : f }.flatten
      run(ruby + load_options + files.map { |f| "-r#{f}" } + options + ["-e", ""] + seed)
    else # pass though
      # no bundle exec: projects with mini and unit-test do not run well via bundle exec testrb
      run ["testrb"] + argv
    end
  end
end