ack3
ack3 copied to clipboard
--color-match 'BOLD blue' works, but not in .ackrc
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
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.
@scottchiefbaker Have you tried --color-match=bold blue in your .ackrc? This works for me.
I am not sure either way if removing quotes is the right thing to do or not.
--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.
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 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.