#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift("#{__dir__}/../lib")

require 'rubocop/server'
server_cli = RuboCop::Server::CLI.new
exit_status = server_cli.run
exit exit_status if server_cli.exit?

if RuboCop::Server.running?
  exit_status = RuboCop::Server::ClientCommand::Exec.new.run
else
  require 'rubocop'
  exit_status = RuboCop::CLI.new.run
end
exit exit_status
