summaryrefslogtreecommitdiffstats
path: root/CLI/ruby/bin
diff options
context:
space:
mode:
authora14m <[email protected]>2021-02-10 22:35:11 +0100
committera14m <[email protected]>2021-02-10 22:42:56 +0100
commit80776ace98f5d532366e4432beaf20cd96e10a3b (patch)
tree6ec5ef3dc99784721a79bbb28a49139845387f53 /CLI/ruby/bin
parent9ba51d3f6b2920291deb0793413661b29322b75a (diff)
Better and more performant ruby rendering in alternative terminal
Ref: https://github.com/ruby/ruby/blob/ruby_2_7/lib/irb/easter-egg.rb#L112-L131 Ref: https://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script Ref: https://superuser.com/questions/122911/what-commands-can-i-use-to-reset-and-clear-my-terminal
Diffstat (limited to 'CLI/ruby/bin')
-rwxr-xr-xCLI/ruby/bin/game-of-life8
1 files changed, 5 insertions, 3 deletions
diff --git a/CLI/ruby/bin/game-of-life b/CLI/ruby/bin/game-of-life
index 16dc0fa..08dbeca 100755
--- a/CLI/ruby/bin/game-of-life
+++ b/CLI/ruby/bin/game-of-life
@@ -8,7 +8,7 @@ class CLI < Thor
map %w[-v --version] => :version
desc "--version, -v", "Prints the Game of Life version information"
def version
- puts "Game of Life version #{GameOfLife::VERSION}"
+ print "Game of Life version #{GameOfLife::VERSION}"
end
default_task :start
@@ -50,8 +50,10 @@ end
begin
CLI.start(ARGV)
rescue SystemExit, Interrupt
- "Do nothing when user exits with Interrupt (CMD/Ctrl + C)"
+ # Print Seed/File used in previous run when user exits with Interrupt (CMD/Ctrl + C)
+ print "\e[?1049l"
+ print "#{GameOfLife::BANNER}\n\e[0m"
rescue NotImplementedError, GameOfLife::Error => e
- puts e.message
+ print e.message
exit(-1)
end