Documentation about --type-add

409 views
Skip to first unread message

Ethan Glasser-Camp

unread,
Jul 2, 2008, 2:14:41 PM7/2/08
to ack dev/users
The documentation clearly shows

--type-add TYPE=.EXTENSION[,.EXT2[,...]]

But the correct syntax (at least on my KUbuntu system) seems to be

--type-add=TYPE=.EXTENSION[,.EXT2[,...]]

(i.e. with an equals sign after --type-add). If this is the actual
correct syntax, can the documentation be updated?

(I'm running ack version 1.80 and perl 5.8.8-12.)

Ethan

tom

unread,
Aug 19, 2008, 11:13:15 AM8/19/08
to ack dev/users
Neither seems to work for me

$ ack --type-add=drupal=.module,.php
ack: --type-add: Type "drupal" does not exist, creating with
".module,.php" ...
ack: No regular expression found.

$ack --type-add drupal=.module,.php
ack: --type-add: Type "drupal" does not exist, creating with
".module,.php" ...
ack: No regular expression found.

Am I doing something stupid (I'd guess yes, but I don't know quite
what.)

Thanks,
Tom

Ethan Glasser-Camp

unread,
Aug 19, 2008, 11:19:58 AM8/19/08
to ack-...@googlegroups.com
On Tue, 2008-08-19 at 08:13 -0700, tom wrote:
> $ ack --type-add=drupal=.module,.php
> ack: --type-add: Type "drupal" does not exist, creating with
> ".module,.php" ...
> ack: No regular expression found.
>
> $ack --type-add drupal=.module,.php
> ack: --type-add: Type "drupal" does not exist, creating with
> ".module,.php" ...
> ack: No regular expression found.
>
> Am I doing something stupid (I'd guess yes, but I don't know quite
> what.)

I could be wrong, but I think this is expected behavior. --type-add only
adds a type for the one execution, and the execution wants to do a
search. Try giving a pattern to search for to test your --type-add. If
it works, maybe add it to your .ackrc.

Ethan


Christopher J. Madsen

unread,
Aug 19, 2008, 11:42:51 AM8/19/08
to ack-...@googlegroups.com
On Tue, August 19, 2008 10:13 am, tom wrote:
>
> Neither seems to work for me
>
> $ ack --type-add=drupal=.module,.php
> ack: --type-add: Type "drupal" does not exist, creating with
> ".module,.php" ...
> ack: No regular expression found.

First, you should use --type-set instead of --type-add to create a new
type. (--type-add is for adding extensions to an existing type.) That
will eliminate the warning about 'Type "drupal" does not exist'.

Second, you have to include --type-set every time you run ack. (Or at
least every time you want to use that type.) The simplest way to do that
is to add it to .ackrc. Note that every line in .ackrc becomes one
argument on the command line, so you have to use the double-equals syntax
shown above (or use two lines).

--
Chris Madsen pe...@cjmweb.net
-------------------- http://www.cjmweb.net --------------------

Reply all
Reply to author
Forward
0 new messages