Sha256: 97297298f1dacece576a89c2d023f4b91f0265d354a20fe84a607a7d23bed45b
Contents?: true
Size: 559 Bytes
Versions: 20
Compression:
Stored size: 559 Bytes
Contents
# frozen_string_literal: true module Puppet::Util::Terminal # Attempts to determine the width of the terminal. This is currently only # supported on POSIX systems, and relies on the claims of `stty` (or `tput`). # # Inspired by code from Thor; thanks wycats! # @return [Number] The column width of the terminal. Defaults to 80 columns. def self.width if Puppet.features.posix? result = %x(stty size 2>/dev/null).split[1] || %x(tput cols 2>/dev/null).split[0] end (result || '80').to_i rescue 80 end end
Version data entries
20 entries across 20 versions & 1 rubygems