bin/shellplay in shellplay-0.0.3 vs bin/shellplay in shellplay-0.0.4

- old
+ new

@@ -14,10 +14,11 @@ @session.import(ARGV[0]) continue = true @sleeptime = 1.0/48.0 @lastelapsed = 0 +@noplayprompt = false counter = 1 def usage puts "\nCommands: " puts " h,? show help" @@ -38,12 +39,14 @@ STDIN.gets @lastelapsed = screen.timespent else @lastelapsed = 0 end - puts screen.stdout - puts Paint[screen.stderr, :red] + printf screen.stdout + if screen.stderr != "" + printf "\n#{Paint[screen.stderr, :red]}" + end end def shownext if @session.current_screen and @session.current_screen.stdin display @session.current_screen @@ -63,11 +66,11 @@ @lastelapsed = 0 end end while continue do - printf "\e[36m>\e[0m " + printf "\n\e[36m>\e[0m " if @playprompt printf "\e[35melapsed: #{@lastelapsed}s\e[0m " unless @lastelapsed == 0 command = STDIN.gets.strip case command when /^(?:q|x)$/ puts "\nPlay ended.\n" @@ -83,14 +86,14 @@ when '' shownext else Open3.popen3("bash","-l","-c",command.strip) do |i, o, e, t| o.read.split("\n").each do |line| - puts line + printf line sleep sleeptime end e.read.split("\n").each do |line| - puts Paint[line, :red] + printf Paint[line, :red] end end end end