On Wed, 12 Apr 2006, Florian Frank wrote:

> It seems to work fine here:
>
> closure:~ flori$ ruby
> require 'term/ansicolor'
> include Term::ANSIColor
> print red, bold, "red bold", reset, "\n"
> *red bold*
>
> Have you required the library before trying to use it?
>
> Florian

that's good stuff florian!  any idea how to make this work? (it's a snippet out
of something i'm working on attm):


     harp:~ > cat a.rb
     require 'readline'
     require 'rubygems'
     require_gem 'term-ansicolor'
     class ::String; include Term::ANSIColor; end


     complete = lambda do |words|
       words = words.strip.split(%r/\s+/) unless Array === words
       Readline::completion_proc = lambda do |s|
         list = words.select{|c| c.index s}
         list = list.empty? ? words : list
         list.map{|word| word.blue}
       end
     end

     sif_in = []

     readline =
       if STDIN.tty?
         lambda{|prompt| line = Readline::readline(prompt.strip.red.dark.bold.underline << " ").to_s.strip; sif_in << line; line.empty? ? nil : line}
       else
         lambda{|prompt| line = STDIN.gets.to_s.strip; sif_in << line; line.empty? ? nil : line}
       end


     complete['one two three']
     line = readline['number >']
     puts line


the interaction between the completion_proc and term-ansicolor results in the
the escape codes being shown literally?  thoughts?

thanks.

-a
-- 
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama