def run(_, command)
raise ArgumentError, "--gears requires a command" if options.gears && command.blank?
raise ArgumentError, "--limit must be an integer greater than zero" if options.limit && options.limit < 1
ssh = check_ssh_executable! options.ssh
if options.gears
run_on_gears(command.join(' '), find_app(:with_gear_groups => true))
0
else
rest_app = find_app
$stderr.puts "Connecting to #{rest_app.ssh_string.to_s} ..." unless command.present?
debug "Using user specified SSH: #{options.ssh}" if options.ssh
command_line = [ ssh.split, rest_app.ssh_string.to_s, command].flatten.compact
debug "Invoking Kernel.exec with #{command_line.inspect}"
Kernel.send(:exec, *command_line)
end
end