ack3 icon indicating copy to clipboard operation
ack3 copied to clipboard

--color-match 'BOLD blue' works, but not in .ackrc

Open scottchiefbaker opened this issue 12 years ago • 6 comments

If I run

ack --color-match 'BOLD blue' findme

It works and highlights the code in bold blue. If I put

--color-match 'BOLD blue'

in my .ackrc and try and find some code, I get an error that says

Invalid attribute name 'bold at /usr/bin/ack line 2198

scottchiefbaker avatar Dec 07 '13 00:12 scottchiefbaker

The problem here is that $ENV{ACK_COLOR_MATCH} still has the quotes (on my windows box, if I set the value to "bold blue" and print it out, the double quotes come along for the ride). This confuses the Term::ANSIColor::colored call. Both types of quotes should probably be stripped from this, and the other color options. I'm not sure where the best place to do that is, but if someone gives me a hint, I'd love to contribute a fix.

jgbishop avatar Apr 03 '14 15:04 jgbishop

@scottchiefbaker Have you tried --color-match=bold blue in your .ackrc? This works for me.

hoelzro avatar Apr 03 '14 17:04 hoelzro

I am not sure either way if removing quotes is the right thing to do or not.

petdance avatar Apr 03 '14 17:04 petdance

--color-match=bold blue does work in my .ackrc

Slightly confusing because in this example quotes are REQUIRED on the command line because of the space, but FORBIDDEN in the config file.

Easy enough work around though I guess.

scottchiefbaker avatar Apr 03 '14 17:04 scottchiefbaker

I hadn't thought of trying it without the quotes in the .ackrc file. I guess that workaround nullifies the necessity of the patch, but this discrepancy probably ought to be documented.

jgbishop avatar Apr 03 '14 17:04 jgbishop

@jgbishop I think striping the quotes for certain options (i.e. color options that are known to have spaces) is a good idea. That will prevent any confusion moving forward.

scottchiefbaker avatar Apr 03 '14 17:04 scottchiefbaker