ack3 icon indicating copy to clipboard operation
ack3 copied to clipboard

Add option for color search

Open NormanTUD opened this issue 2 years ago • 2 comments

An idea that I had that would be very useful and kind of straightforward to implement (still lots of special cases sadly) would be a color search.

Let's say I enter

ack --colorsearch "#ff0000"

and internally it searches for red, #f00, #ff0000, rgb(255, 0, 0), ...

This would be greatly appreciated I think!

NormanTUD avatar Aug 29 '22 12:08 NormanTUD

Thanks for the idea. That's a pretty specific use case that has an awful lot of edge cases. I think it might be easier for you to implement it yourself with shell aliases.

Maybe you'd want a shell script wrapper around ack that was able to take a color and make those different patterns, so that if you typed

colorack ffcc22

it would translate that to

ack '(#fc2\b|#ffcc22\b|\brgb\(\s*255\s*,\s*204\s*,\s*34\s*\))'

ack by design does not know anything about the text it's searching.

petdance avatar Aug 29 '22 14:08 petdance

Hmm, maybe I'll add this to #Cookbook https://github.com/beyondgrep/website/issues/103

n1vux avatar Aug 29 '22 16:08 n1vux