Ignore-dir/ignore-file lists

27 views
Skip to first unread message

Tony Woode

unread,
Jul 28, 2017, 9:48:08 AM7/28/17
to ack users
I used to be able to
ack some-text -ri --ignore-dir={node_modules,build} --ignore-file={ext:sql, is:app.js} .

but lately I can't any longer supply those {lists}. The manual nowsays


--[no]ignore-dir=DIRNAME, --[no]ignore-directory=DIRNAME

Ignore directory (as CVS, .svn, etc are ignored). May be used multiple times to ignore multiple directories.


If I have a large list of (diffuse) directories and/or file names to omit, what is my best bet?

Andy Lester

unread,
Jul 28, 2017, 9:53:14 AM7/28/17
to ack-...@googlegroups.com
I used to be able to 
ack some-text -ri --ignore-dir={node_modules,build} --ignore-file={ext:sql, is:app.js} .

There’s never been anything in ack to allow or disallow that.  Those sorts of expansions are probably done in the shell.

For example, try this:

$ echo foo={x,y,z} bar={a,b,c}
foo=x foo=y foo=z bar=a bar=b bar=c

That’s the shell expanding those, not ack.

If you’re often doing those sorts of ignores, put them in an .ackrc.
—ignore-dir=node
—ignore-dir=build
—ignore-file=ext:sql
—ignore-file=is:app.js

You can put them in ~/.ackrc in your home directory, or you can put an .ackrc at the top of your project directory.  The project-level .ackrc gives you more flexibility.

As an aside: You don’t need the -r.  That’s ack’s default.

Andy

Andy Lester

unread,
Jul 28, 2017, 11:03:55 AM7/28/17
to ack-...@googlegroups.com
I didn’t notice the . at the end.  -r . is the default for ack.

If you put all those —ignore-dir and —ignore-file and -i in your .ackrc, your command line becomes “ack some-text”, which is the sort of shorthand you normally want.
Reply all
Reply to author
Forward
0 new messages