bin/simulate in log_simulator-0.1.3 vs bin/simulate in log_simulator-0.2.0

- old
+ new

@@ -4,19 +4,23 @@ require 'optparse' require 'peak_log_simulator' require 'resolve' require 'socket_connetion' -options={:filepath => nil ,:timescale => 1.0} +options={:filepath => nil ,:timescale => 1.0, :pretty => false} opts = OptionParser.new do |opts| opts.banner = "Usage: simulate [logfile path] [options]" opts.on('-t time',Float,'timescale. Default is 1.0') do |time| options[:timescale] = time end + opts.on('-p','--pretty','Pretty Log Messages') do + options[:pretty] = true + end + opts.on('-v','--version','Version') {puts LogSimulator::VERSION; exit} opts.on_tail('-h', '--help', 'Show this message') { puts opts; exit } end @@ -35,10 +39,10 @@ LogSimulator::Resolver.select_target(2.0) do |target| puts "Connection to #{target.name} - #{target.target_name} :#{target.port}" socket_connection = LogSimulator::SocketConnetion.new(target.target_name,target.port) unless options[:filepath].nil? - LogSimulator::PeakLogSimulator.start(socket_connection.socket,options[:filepath],options[:timescale]) do |success| + LogSimulator::PeakLogSimulator.start(socket_connection.socket,options[:filepath],options[:timescale],options[:pretty]) do |success| while true #TODO: make it DRY print '>' message = gets.chomp socket_connection.socket.puts message end