bin/shellplay in shellplay-0.1.6 vs bin/shellplay in shellplay-0.1.7
- old
+ new
@@ -28,10 +28,12 @@
puts " <command> execute a subcommand in a bash -l -c"
puts " x,q quit"
puts
end
+# generic display method
+#
def display(screen)
if screen.clearscreen
if ENV['TERM_PROGRAM'] = 'iTerm.app'
print "\e]50;ClearScrollback\a"
else
@@ -57,10 +59,11 @@
if screen.stderr != ""
printf "\n#{Paint[screen.stderr, :red]}"
end
end
+# move to the next screen
def shownext
if @session.current_screen and @session.current_screen.stdin
display @session.current_screen
@session.next
else
@@ -68,10 +71,11 @@
@playprompt = false
@lastelapsed = 0
end
end
+# move to the previous screen
def showprevious
if @session.pointer > 0
@session.previous
@session.previous
display @session.current_screen
@@ -79,10 +83,11 @@
else
puts "There is no previous screen."
end
end
+# jump to an arbitrary screen
def show(index)
if @session.show(index) && @session.show(index).stdin
display @session.show(index)
@session.next
else
@@ -91,9 +96,10 @@
end
end
print "\n\e[33m>\e[0m Type <enter> to begin."
+# main loop
while continue do
command = STDIN.gets.strip
case command
when /^(?:q|x)$/
puts "\nPlay ended.\n"