Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/bitflyer/cli/command/summary_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class SummaryCommand
include HasHTTPClient
include HasRealtimeClient

BUFFER_SIZE = 30

def initialize
@current_price = 0.0

Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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
Expand Down