Sha256: 29ca39ceab273e9628ccc3436986c5c2a9da540c78d553e7b14369db14763189
Contents?: true
Size: 572 Bytes
Versions: 20
Compression:
Stored size: 572 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 return (result || '80').to_i rescue return 80 end end
Version data entries
20 entries across 20 versions & 1 rubygems