Sha256: ec3581563540758fd2b3b878645eca107a1036661431be4208f016ad5c241d2b

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

module MyScripts
  # This script should be used as a pipe to colorize ANSI output on Windows
  # Use case is like this (provides colorized autotest output):
  #
  # > autotest | ansi
  #
  class Ansi < Script
    VERSION = '0.0.1'

    def initialize(name, cli, argv, argf)
      require 'win32console'
      @cli = cli
      @io = Win32::Console::ANSI::IO.new()
      super
    end

    def run
      Signal.trap('INT', nil)  # Ignores Interrupt (Ctrl-C) - it is used by autotest

      until @cli.stdin.eof? do
        line = @cli.stdin.gets
        @io.puts line
      end
      @io.flush
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
my_scripts-0.1.15 lib/my_scripts/scripts/ansi.rb
my_scripts-0.1.14 lib/my_scripts/scripts/ansi.rb
my_scripts-0.1.13 lib/my_scripts/scripts/ansi.rb