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

require_relative "../lib/rouge"
require_relative "../lib/rouge/cli"

Signal.trap('PIPE', 'SYSTEM_DEFAULT') if Signal.list.include? 'PIPE'

begin
  Rouge::CLI.parse(ARGV).run
rescue Rouge::CLI::Error => e
  puts e.message
  exit e.status
rescue Interrupt
  $stderr.puts "\nrouge: interrupted"
  exit 2
end
