beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

ack does not search stdin from terminal #603

Closed fazjaxton closed 8 years ago

fazjaxton commented 8 years ago

From the help text:

ack may also search STDIN, but only if no file or directory arguments are
specified, or if one of them is "-".

However, when no files are specified, ack recursively searches the current directory:

ack .

And when "-" is specified, it is treated as a file name:

$ ack . -
ack: -: No such file or directory

I understand the usefulness of the first case, as this is probably what people mean 90+% of the time, but when the user explicitly asks for stdin (as in the second case), it would be nice to let them have it.

petdance commented 8 years ago

You're asking it to both descend through a tree AND search stdin. I don't see how that would make sense to do.

fazjaxton commented 8 years ago

I don't want it to search through the tree. In this case I mean "." as the pattern (matching anything). The results are equivalent with "a":

$ ack a

searches the tree, and:

$ ack a -
ack: -: No such file or directory
petdance commented 8 years ago

Ah, ok, you want ack foo --filter.

petdance commented 8 years ago
  --[no]filter                  Force ack to treat standard input as a pipe
                                (--filter) or tty (--nofilter)
fazjaxton commented 8 years ago

Oh, great! Thanks! Sorry, should have found that myself. :)

petdance commented 8 years ago

Not a problem. It took me a minute to find it myself. :-)