Skip to content

Commit 9fb0daa

Browse files
Merge pull request #143 from bitflyer-tools/feat/improve-summary-tui
feat: improve summary TUI experience
2 parents 8ef24d9 + ebbb7e4 commit 9fb0daa

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/bitflyer/cli/command/summary_command.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ class SummaryCommand
99
include HasHTTPClient
1010
include HasRealtimeClient
1111

12-
BUFFER_SIZE = 30
13-
1412
def initialize
1513
@current_price = 0.0
1614

@@ -23,6 +21,7 @@ def initialize
2321

2422
def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
2523
$stdout.sync = true
24+
print "\e[?25l"
2625

2726
Thread.new do
2827
loop do
@@ -31,6 +30,8 @@ def run # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
3130
end
3231
end
3332

33+
puts "\n" * 3
34+
3435
loop do
3536
print <<~EOS
3637
\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
4041
EOS
4142
sleep 0.1
4243
end
44+
rescue Interrupt
45+
# exit
46+
ensure
47+
print "\e[?25h"
4348
end
4449

4550
private

0 commit comments

Comments
 (0)