Class: Flatito::Renderer::TTY
- Inherits:
-
Base
- Object
- Base
- Flatito::Renderer::TTY
show all
- Defined in:
- lib/flatito/renderer.rb
Constant Summary
collapse
- CSI =
"\e["
- CLEAR_LINE =
"#{CSI}K\e[0G".freeze
- HIDE_CURSOR =
"#{CSI}?25l".freeze
- SHOW_CURSOR =
"#{CSI}?25h".freeze
Instance Attribute Summary
Attributes inherited from Base
#no_color, #search
Instance Method Summary
collapse
Methods inherited from Base
#print_item, #print_items
#regex
Methods included from Utils
#truncate
Constructor Details
#initialize(options) ⇒ TTY
Returns a new instance of TTY.
94
95
96
97
|
# File 'lib/flatito/renderer.rb', line 94
def initialize(options)
super
require "io/console"
end
|
Instance Method Details
#clear_line ⇒ Object
128
129
130
|
# File 'lib/flatito/renderer.rb', line 128
def clear_line
stdout.print CLEAR_LINE
end
|
#ending ⇒ Object
114
115
116
117
118
|
# File 'lib/flatito/renderer.rb', line 114
def ending
clear_line
show_cursor
stdout.puts
end
|
#hide_cursor ⇒ Object
120
121
122
|
# File 'lib/flatito/renderer.rb', line 120
def hide_cursor
stdout.print HIDE_CURSOR
end
|
#prepare ⇒ Object
99
100
101
102
|
# File 'lib/flatito/renderer.rb', line 99
def prepare
listen_for_stdout_width_change
hide_cursor
end
|
#print_file_progress(pathname) ⇒ Object
104
105
106
107
|
# File 'lib/flatito/renderer.rb', line 104
def print_file_progress(pathname)
print truncate(pathname.to_s, stdout_width - 4)
clear_line
end
|
#print_pathname(pathname) ⇒ Object
109
110
111
112
|
# File 'lib/flatito/renderer.rb', line 109
def print_pathname(pathname)
clear_line
super
end
|
#show_cursor ⇒ Object
124
125
126
|
# File 'lib/flatito/renderer.rb', line 124
def show_cursor
stdout.print SHOW_CURSOR
end
|