diff --git a/lib/bitflyer/cli/command/summary_command.rb b/lib/bitflyer/cli/command/summary_command.rb index ddf0086..28a30c4 100644 --- a/lib/bitflyer/cli/command/summary_command.rb +++ b/lib/bitflyer/cli/command/summary_command.rb @@ -9,8 +9,6 @@ class SummaryCommand include HasHTTPClient include HasRealtimeClient - BUFFER_SIZE = 30 - def initialize @current_price = 0.0 @@ -23,6 +21,7 @@ def initialize def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength $stdout.sync = true + print "\e[?25l" Thread.new do loop do @@ -31,6 +30,8 @@ def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength end end + puts "\n" * 3 + loop do print <<~EOS \e[4F\e[0JCurrent: #{@current_price.to_i.to_s.split_by_comma} @@ -40,6 +41,10 @@ def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength EOS sleep 0.1 end + rescue Interrupt + # exit + ensure + print "\e[?25h" end private