bin/shellplay in shellplay-0.0.4 vs bin/shellplay in shellplay-0.0.5
- old
+ new
@@ -30,20 +30,31 @@
puts " x,q quit"
puts
end
def display(screen)
+ if screen.clearscreen
+ if ENV['TERM_PROGRAM'] = 'iTerm.app'
+ printf "\e]50;ClearScrollback\a"
+ else
+ printf "\e\143"
+ end
+ end
if screen.displaycommand
- print @session.config.prompt
+ if screen.customprompt
+ print screen.customprompt
+ else
+ print @session.config.prompt
+ end
sleep @sleeptime
print screen.stdin
STDIN.gets
@lastelapsed = screen.timespent
else
@lastelapsed = 0
end
- printf screen.stdout
+ print screen.stdout
if screen.stderr != ""
printf "\n#{Paint[screen.stderr, :red]}"
end
end
@@ -66,12 +77,12 @@
@lastelapsed = 0
end
end
while continue do
- printf "\n\e[36m>\e[0m " if @playprompt
- printf "\e[35melapsed: #{@lastelapsed}s\e[0m " unless @lastelapsed == 0
+ print "\n\e[36m>\e[0m " if @playprompt
+ print "\e[35melapsed: #{@lastelapsed}s\e[0m " unless @lastelapsed == 0
command = STDIN.gets.strip
case command
when /^(?:q|x)$/
puts "\nPlay ended.\n"
continue = false
@@ -86,14 +97,14 @@
when ''
shownext
else
Open3.popen3("bash","-l","-c",command.strip) do |i, o, e, t|
o.read.split("\n").each do |line|
- printf line
+ print line
sleep sleeptime
end
e.read.split("\n").each do |line|
- printf Paint[line, :red]
+ print Paint[line, :red]
end
end
end
end