#!/usr/bin/env ruby

require 'r10k/cli'
require 'colored2'

begin
  R10K::CLI.command.run(ARGV)
rescue Interrupt
  $stderr.puts "r10k: Aborted!".red
  exit(1)
rescue SystemExit => e
  exit(e.status)
rescue Exception => e
  $stderr.puts "\nr10k: Runtime error: #{e.inspect}".red
  $stderr.puts e.backtrace.join("\n").red if ARGV.include? '--trace'
  exit(1)
end
