monochromegane / the_platinum_searcher

A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.
MIT License
2.81k stars 141 forks source link

--ignore-case with -g option #175

Closed vbauerster closed 5 years ago

vbauerster commented 7 years ago

Option -g doesn't respect neither -i nor -S options, so there is no way match path pattern case insensitively.

For example Given pwd files

├── context
│   └── context.txt
├── depth
│   ├── Context.txt
│   ├── dir_1
│   │   ├── dir_2
│   │   │   └── file_3.txt
│   │   └── file_2.txt
│   └── file_1.txt

running pt -ig context produces context/context.txt.

should:

depth/Context.txt
context/context.txt
vbauerster commented 7 years ago

With -G option it is ambiguous to respect -i and -S options (imho), because when -G is specified there are two patterns: one for path limit and one for content.

By the way, ag treats -g and -G options with -i always on, i.e. if either -g or -G is specified -i is implied. Maybe it is bug in ag.

rosshadden commented 6 years ago

Just came here to ask about why -g wasn't respecting -i, wondering if it was a bug. I ended up using ag for this specific purpose instead, because as stated it returns all matches. Not sure if it's a bug or not but I think it's more helpful to return too many matches than too few, as the former can be handled by the user with some extra work.

vbauerster commented 6 years ago

Well, I used to submit pr, which would fix this, but looks like it didn't get any attention. Personally I've switched to rg.

rosshadden commented 6 years ago

@vbauerster I tried switching but they have no real equivalent of -g. The closest they have is --files -g or something, but that didn't even come close to what I wanted, like respecting gitignore.

BurntSushi commented 6 years ago

@rosshadden rg --files respects gitignore. If it isn't, please file a bug.

rosshadden commented 6 years ago

@BurntSushi I don't mean to turn this into a conversation about rg, but the --files argument is just not anywhere close to how -g behaves in ack, ag, or pt. I have brought this up in its github before but users of rg don't seem to care.

For example pt -g foo will find the following:

test/a/b.c
test/a.b
a/test/b.c
a/b/c/d/e/test/f.g
a/b/c/d/test.e
foo-test
foo_test
testing

Whereas rg --files test finds just:

test/a/b.c
test/a.b

And rg --files -g test finds nothing at all. I have been as of yet unable to find a series of arguments that comes even remotely close to what these other projects all handle consistently.

BurntSushi commented 6 years ago

Please file a bug on the proper issue tracker. Not here.

On Oct 1, 2017 1:39 PM, "Ross Hadden" notifications@github.com wrote:

@BurntSushi https://github.com/burntsushi I don't mean to turn this into a conversation about rg, but the --files argument is just not anywhere close to how -g behaves in ack, ag, or pt. I have brought this up in its github before but users of rg don't seem to care.

For example pt -g foo will find the following:

test/a/b.c test/a.b a/test/b.c a/b/c/d/e/test/f.g a/b/c/d/test.e foo-test foo_test testing

Whereas rg --files test finds just:

test/a/b.c test/a.b

And rg --files -g test finds nothing at all. I have been as of yet unable to find a series of arguments that comes even remotely close to what these other projects all handle consistently.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/monochromegane/the_platinum_searcher/issues/175#issuecomment-333393161, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb34i1IADCrmp7MuOLPHbH0g4Y4gQ-Oks5sn85UgaJpZM4Mk7t6 .