def run_command
load_options_from_config_file! unless CONFIGLESS_COMMANDS.include?(@command)
Command.script = File.expand_path($PROGRAM_NAME)
Dir.chdir(@options[:chdir]) unless CONFIGLESS_COMMANDS.include?(@command)
@options[:require].each { |r| ruby_require r }
Logging.debug = @options[:debug]
Logging.trace = @options[:trace]
controller = case
when cluster? then Controllers::Cluster.new(@options)
when service? then Controllers::Service.new(@options)
else Controllers::Controller.new(@options)
end
if controller.respond_to?(@command)
begin
controller.send(@command, *@arguments)
rescue RunnerError => e
abort e.message
end
else
abort "Invalid options for command: #{@command}"
end
end