Sha256: b209d627be6c6544195b5a092911fc649da285a1bcb6cf0db1960999a4dfc0f1

Contents?: true

Size: 748 Bytes

Versions: 55

Compression:

Stored size: 748 Bytes

Contents

module GLI
  module Commands
    module HelpModules
      # Formats text in one line, stripping newlines and NOT wrapping
      class TTYOnlyWrapper
        # Args are ignored entirely; this keeps it consistent with the TextWrapper interface
        def initialize(width,indent)
          @proxy = if STDOUT.tty?
                     TextWrapper.new(width,indent)
                   else
                     OneLineWrapper.new(width,indent)
                   end
        end

        # Return a wrapped version of text, assuming that the first line has already been
        # indented by @indent characters.  Resulting text does NOT have a newline in it.
        def wrap(text)
          @proxy.wrap(text)
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
gli-2.22.2 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.22.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.22.0 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.5 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.4 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.3 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.2 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.21.0 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.20.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.20.0 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.19.2 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.19.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.19.0 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.18.2 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.18.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.18.0 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.17.2 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.17.1 lib/gli/commands/help_modules/tty_only_wrapper.rb
gli-2.17.0 lib/gli/commands/help_modules/tty_only_wrapper.rb