svent / sift

A fast and powerful alternative to grep
https://sift-tool.org
GNU General Public License v3.0
1.6k stars 108 forks source link

Request: Allow --type, --ext and --files #58

Closed MiguelLatorre closed 8 years ago

MiguelLatorre commented 8 years ago

It would be great to select files like (for example):

sift --type=cc,cpp --files=CMakeLists.txt --files=Makefile --ext=mak,def

Currently, one can use multiple --type, --file and --ext, but not mixed. Maybe, allowing creating new types in .sift.conf?

I'm very close to fully replace ack with sift! Great work.

svent commented 8 years ago

If I understand this correctly, you would want to combine the filtering options via OR instead of AND?

That is not possible with the current design of the filtering options - as you suggest, allowing custom types in the sift config would be the best solution in that case. If I understood the request correctly, I will implement it that way.

MiguelLatorre commented 8 years ago

I think your interpretation is correct, but just in case: I wanted to grep for makefile files. If I have, to simplify, in current directory, the files:

Makefile
a.mak

Reading the docs, I thought I should use something like:

sift --files=Makefile --ext=mak --targets

I expected to see both files printed, but I saw none.

svent commented 8 years ago

Thanks for the clarification. It is correct that sift shows nothing, as those options mean "all files named 'Makefile' AND having the extension '.mak'".

I think custom types are the best (and most flexible) option here, so I will implement that.

svent commented 8 years ago

This is now implemented, please see this blog post: https://svent.github.io