#!/usr/bin/env ruby require 'require_all' module Rebuild require_relative '../lib/rbld_commands' require_rel '../lib/commands' end begin rbld_log.info( "ARGV: #{ARGV.join(' ')}" ) if !ARGV[0] || (ARGV[0] == "help" && !ARGV[1]) puts Rebuild::CLI::Main.usage puts exit 0 end if ARGV[0] == "help" Rebuild::CLI::Commands.usage( ARGV[1] ) exit 0 end if ARGV[1] == "--help" || ARGV[1] == "-h" Rebuild::CLI::Commands.usage( ARGV[0] ) exit 0 end exit Rebuild::CLI::Commands.run( ARGV[0], ARGV.drop(1) ) || 0 rescue StandardError => e rbld_print.error(e.message) e.backtrace.each { |l| rbld_log.fatal(l) } exit 1 end