Module: StackMaster::Commands::TerminalHelper
- Included in:
- ListStacks, Outputs, Status, Tidy
- Defined in:
- lib/stack_master/commands/terminal_helper.rb
Instance Method Summary collapse
Instance Method Details
#unix_window_size ⇒ Object
16 17 18 |
# File 'lib/stack_master/commands/terminal_helper.rb', line 16 def unix_window_size `tput cols`.chomp end |
#window_size ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/stack_master/commands/terminal_helper.rb', line 6 def window_size size = ENV.fetch("COLUMNS") { OS.windows? ? windows_window_size : unix_window_size } if size.nil? || size == "" 80 else size.to_i end end |
#windows_window_size ⇒ Object
20 21 22 23 24 25 |
# File 'lib/stack_master/commands/terminal_helper.rb', line 20 def windows_window_size columns_regex = %r{^\s+Columns:\s+([0-9]+)$} output = `mode con` columns_line = output.split("\n").select { |line| line.match(columns_regex) }.last columns_line.match(columns_regex)[1] end |