Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Use ANSI codes in printed output, including colors and controlling the cursor, clearing the line, and clearing the screen.
branch: master

typo fix

latest commit c031625550
Steven Soroka authored
Failed to load latest commit information.
lib first
test first
.gitignore first
README.rdoc typo fix
Rakefile increment version
ansi.gemspec new gemspec
init.rb docs, plugin stuff

README.rdoc

ANSI

DESCRIPTION

Use ANSI codes in printed output, including colors and controlling the cursor, clearing the line, and clearing the screen.

INSTALLATION

as a gem:

sudo gem install ssoroka-ansi

as a plugin:

script/plugin install git://github.com/ssoroka/ansi.git

USAGE

require 'ansi' # if not installed as a plugin.

1) Simply control the cursor:

>> puts "HELLO" + ANSI.right(30) + "THERE!"
HELLO                              THERE!

2) use colors:

>> puts ANSI.color(:red) { "hello there" }
>> puts ANSI.color(:green) + "Everything is green now" + ANSI.no_color

3) loops:

printf ANSI.clear_screen
puts "Processing users..."
max = User.count
User.all.each_with_index {|user, index|
  user.update_something!
  printf ANSI.left(50) + "Processed #{index}/#{max} users..."
}
puts " done!"
Something went wrong with that request. Please try again.