ack3 icon indicating copy to clipboard operation
ack3 copied to clipboard

Should a file type filter like --test on the CLI override a previous --notest?

Open hoelzro opened this issue 5 years ago • 3 comments

For example: Go uses the convention *_test.go for its test files. Most of the time when searching through a codebase I'm not interested in results from test files, so I have the following in my .ackrc:

--type-add=test:match:.*_test[.]go$
--type-add=test:ext:t
--notest

Today, I was interested in some results from test files, so I did ack -wi root --test, but got no results, because --notest from my ackrc was taking effect.

Is overriding --notest with a later --test functionality that ack should have? If not, should --notest and --test issue a mutually exclusive error?

hoelzro avatar Oct 09 '20 18:10 hoelzro

i had thought Ack had the convention that any flag on commandline overrides Environment overrides Ackrc, so i think what you did should have worked and thus would be exposing a bug.

(Might need a test case that fails and a 'blame" bifurcation search?)

n1vux avatar Oct 09 '20 19:10 n1vux

The --test on the command line should have overridden the --notest in the ackrc.

petdance avatar Oct 09 '20 19:10 petdance

A --test on the command line will also a --notest preceding it on the command line.

petdance avatar Oct 09 '20 19:10 petdance