On Wednesday 02 November 2011 06:19:20 Marc H. wrote:
Has anyone written such a class? I am asking before I write my own
version of grep.
There’s rak [1], although I don’t know exactly what kind of colour
support you
need. If you use ruby 1.9, you may want to apply the patch described in
the
pull request in rak’s github page. Without it, it’ll stop at the first
non-
ASCII character it finds.
ack is written purely in Perl, and takes advantage of
the power of Perl’s regular expressions
I am using Ruby, not Perl.
If I would use ack, in perl, then I could use grep, in C,
which is the same difference - both is not Ruby.
The reason I need it, in ruby, is because I want to connect
it to my pseudo-shell which is written in pure Ruby right now.
On Linux this may be irrelevant but my pseudo-shell shall
work on Windows too without any further downloads.
There’s rak [1], although I don’t know exactly what kind
of colour support you need.
Basically just ANSI Colour code.
You know, the classical XTERM escape codes:
BLACK = “\e[0;30m”
RED = “\e[0;31m”
If you use ruby 1.9, you may want to apply the
patch described in the pull request in rak’s
github page. Without it, it’ll stop at the
first non-ASCII character it finds.
Ok thanks! I checked it out, it looks really neat so far.
Also uses colours.
I think it is 98% what I am looking for … I will play
with it intensively.