0.0
No commit activity in last 3 years
No release in over 3 years
Use ANSI codes in printed output, including colors and controlling the cursor, clearing the line, and clearing the screen.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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!"