Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium163.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : infihsqw ( 644)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /opt/alt/ruby33/share/gems/gems/bundler-2.5.11/lib/bundler/vendor/thor/lib/thor/shell/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/ruby33/share/gems/gems/bundler-2.5.11/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb
class Bundler::Thor
  module Shell
    module Terminal
      DEFAULT_TERMINAL_WIDTH = 80

      class << self
        # This code was copied from Rake, available under MIT-LICENSE
        # Copyright (c) 2003, 2004 Jim Weirich
        def terminal_width
          result = if ENV["THOR_COLUMNS"]
            ENV["THOR_COLUMNS"].to_i
          else
            unix? ? dynamic_width : DEFAULT_TERMINAL_WIDTH
          end
          result < 10 ? DEFAULT_TERMINAL_WIDTH : result
        rescue
          DEFAULT_TERMINAL_WIDTH
        end

        def unix?
          RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris)/i
        end

      private

        # Calculate the dynamic width of the terminal
        def dynamic_width
          @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
        end

        def dynamic_width_stty
          `stty size 2>/dev/null`.split[1].to_i
        end

        def dynamic_width_tput
          `tput cols 2>/dev/null`.to_i
        end

      end
    end
  end
end

ZeroDay Forums Mini