P O W !

Override your ‘puts’ for fun shell coloring.

Install (with gemcutter as sauce):

sudo gem install jamescook-pow

Usage:

require "pow"

Examples:

puts.yellow "Hello world in yellow"
puts.red    "Hello world in red" 
puts.red!   "Hello world in red, but with boldness"
puts.red_   "Hello world in red, but with underscore"
puts.rainbow "Hello world, but more silly."

puts_       "Hello world, underscored."
puts!       "Hello world, bold."

puts        "Hello world, and I can highlight matches.", :match => "can"
puts        "Hello world, and I can highlight matches with a specific color.", :match => "can", :match_color => :purple

p.red "Hello world, but less typing .. also red."
p! "Hello world, in bold"
p! "Mix and match", :color => :purple, :background => :black

You can set defaults in your ~/.irbrc or wherever.

require 'pow'
Pow.defaults = {:bold => true}  # Now any puts will default to bold

Profiles:

Pow will try to load “~/.pow_defaults” into the Pow.defaults hash when loaded/required. You can create custom profiles with the Pow::Profile class.

-- IRB Example
   > profile = Pow::Profile.new   # defaults to a file in $HOME
   > profile.settings = {:bold => true, :color => :purple, :on => :black}
   > profile.save
   > Pow.load_profile             # No argument needed if using default settings file

Misc:

Pow can be enabled/disabled with Pow.enable or Pow.disable

There’s a script included that you can pipe text into and output customized text:

cat README | ruby bin/ruby-pow --bold --background=purple