3 ms·
In terms of core features, ripgrep is totally there. It searches fast. It ignores files pretty accurately. It outputs results in a pleasant and useful format. I
by ggreer 10y ago
In terms of core features, ripgrep is totally there. It searches fast. It ignores files pretty accurately. It outputs results in a pleasant and useful format. If a new user tries rg, they'll be very happy.
My warning about the feature differences was meant to temper ag users' expectations. There are lots of little things that ag users are accustomed to that are either different or missing in ripgrep. Off the top of my head: Ag reads the user's global gitignore. (This is harder than most people think.) It detects stdout redirects such as "ag blah > output.txt" and ignores output.txt. It can search gz and xz files. It defaults to smart-case searching. It can limit a search to one hardware device (--one-device), avoiding slow reads on network mounts. And as a commenter already pointed out, it supports the --pager option. Taken together, all those small differences are likely to cause an average ag user some grief. I wanted to manage expectations so that users wouldn't create annoying "issues" (really, feature requests) on your GitHub repo. Sorry if that came off the wrong way.
On a completely unrelated note: I see ripgrep supports .rgignore files, similar to how ag supports .agignore. It'd be nice if we could combine forces and choose a single filename for this purpose. That way when the next search tool comes along, it can use the same thing instead of .zzignore or whatever. It would also make it easier for users to switch between our tools. I'd suggest a generic name like ".ignore" or ".ignores", but I'm sure some tool creates such files or directories already.
Edit: Actually, it looks like .ignore can work. The only examples I've found of .ignore files are actual files containing ignore patterns.
- mvermaat 10y agoI'd say that .ignore is too generic a name. What is to be ignored by what? But I like the idea of standardizing this. Perhaps the cache directory tagging standard gives some inspiration. http://www.brynosaurus.com/cachedir/spec.html http://www.brynosaurus.com/cachedir/spec.html
- samatman 10y agoCould I suggest .ignorerc? I would immediately intuit that such a file is a (r)untime (c)onfiguration for ignoring something. .ignore isn't... bad, it just looks like something I can safely delete, like a file styled `such-and-such~`
- gwern 10y agoIf you're taking the time to create a .ignore file and set up personally-relevant regexps, I doubt you'll forget. (You'll probably also have it versioned.) What I like about '.ignore' is that it's not tied to grep (which will never use it) but expresses that the concept is agnostic. You can imagine lots of programs supporting it.
- kaushalmodi 10y agoMay be .searchignore?
- rurban 10y ago.grepignore
- burntsushi 10y agoYou raise good points, thank you. I hope to support some of those features, since they seem like nice conveniences. In principle I'd be fine standardizing on a common ignore file. We'd need to come up with a format (I think I'd vote for "do what gitignore does", since I think that's what we're both doing now anyway). Adding files to this list is kind of a bummer though. I could probably get away with replacing `.rgignore` proper, but I suspect you'd need to add it without replacing `.agignore`, or else those angry users you were talking about might show themselves. :-) I do kind of like `.grepignore` since `grep` has kind of elevated itself to "search tool" as a term, but I can see how that would be confusing. `.searchignore` feels too long. `.ignore` and `.ignorerc` feel a bit too generic, but either seems like the frontrunner at the moment.
- ggreer 10y agoI also vote for "do what gitignore does". My plan is to add support for the new file name, deprecate .agignore, and update docs everywhere. But it'd be a while before I removed .agignore completely. I really like .ignore, and I like it because it's generic. The information I want it to convey is: > Dear programs, > If you are traversing this directory, please ignore these things. Of course, some programs could still benefit from having application-specific ignore files, but it'd cut down on a lot of cruft and repetition.
- burntsushi 10y agoLet's do it. https://github.com/BurntSushi/ripgrep/issues/40 https://github.com/BurntSushi/ripgrep/issues/40
- ggreer 10y ago…and merged: https://github.com/ggreer/the_silver_searcher/pull/974 https://github.com/ggreer/the_silver_searcher/pull/974 I'll tag a new release in a day or two. Also, it looks like the sift author is getting on the .ignore train: https://github.com/svent/sift/issues/78#issuecomment-249335277 https://github.com/svent/sift/issues/78#issuecomment-2493352... This worked out pretty well. :)
- wyldfire 10y ago> detects stdout redirects Is there a portable way for you to find out that stdout is connected to output.txt? isatty() only tells you that there may be a redirection and I suppose on linux you could use /proc/self/fd/1 but I don't know how to do it portably.
- charliesome 10y agoIf output is redirected, ag calls fstat on stdout and records the inode. It then ignores files based on inode rather than path: https://github.com/ggreer/the_silver_searcher/blob/b995d3b8269b9c395c1dc9ee45f0df9203942df9/src/options.c#L342-L347 https://github.com/ggreer/the_silver_searcher/blob/b995d3b82...
- petre 10y ago.gignore? .ignore is way too generic. .gignore as in grep ignore, rg ignore, ag ignore, they all have a g in their names somewhere. Well, ack doesn't but what kind of name is that anyway; it sounds like someone (the author?) got annoyed with grep's lack of pcre. .gignore seems generic enough, yet specific for these tools. Expecting a single .ignore file to rule them all text search tools is rather too optimistic.