Module: Booker::Term

Defined in:
lib/booker/output.rb

Overview

int number of columns on screen, answered in process rather than by a tput cols subshell on every run. io/console reads /dev/tty rather than stdout, so a width still comes back through a pipe, and nil when there is no terminal at all - a completion subshell, or ci

Class Method Summary collapse

Class Method Details

.widthObject



14
15
16
17
18
# File 'lib/booker/output.rb', line 14

def self.width
  @width ||= IO.console&.winsize&.last&.nonzero? ||
    ENV["COLUMNS"]&.to_i&.nonzero? ||
    100
end