summaryrefslogtreecommitdiffstats
path: root/grep-printer
AgeCommit message (Collapse)Author
2019-04-15grep-printer: release 0.1.2grep-printer-0.1.2Andrew Gallant
2019-04-15grep-searcher: release 0.1.4grep-searcher-0.1.4Andrew Gallant
2019-04-15grep-regex: release 0.1.3grep-regex-0.1.3Andrew Gallant
2019-04-15grep-matcher: release 0.1.2grep-matcher-0.1.2Andrew Gallant
2019-04-15ripgrep: max-column-preview --> max-columns-previewAndrew Gallant
Credit to @okdana for catching this. This naming is a bit more consistent with the existing --max-columns flag.
2019-04-14printer: support previews for long linesAndrew Gallant
This commit adds support for showing a preview of long lines. While the default still remains as completely suppressing the entire line, this new functionality will show the first N graphemes of a matching line, including the number of matches that are suppressed. This was unfortunately a fairly invasive change to the printer that required a bit of refactoring. On the bright side, the single line and multi-line coloring are now more unified than they were before. Closes #1078
2019-04-14binary: rejigger ripgrep's handling of binary filesAndrew Gallant
This commit attempts to surface binary filtering in a slightly more user friendly way. Namely, before, ripgrep would silently stop searching a file if it detected a NUL byte, even if it had previously printed a match. This can lead to the user quite reasonably assuming that there are no more matches, since a partial search is fairly unintuitive. (ripgrep has this behavior by default because it really wants to NOT search binary files at all, just like it doesn't search gitignored or hidden files.) With this commit, if a match has already been printed and ripgrep detects a NUL byte, then it will print a warning message indicating that the search stopped prematurely. Moreover, this commit adds a new flag, --binary, which causes ripgrep to stop filtering binary files, but in a way that still avoids dumping binary data into terminals. That is, the --binary flag makes ripgrep behave more like grep's default behavior. For files explicitly specified in a search, e.g., `rg foo some-file`, then no binary filtering is applied (just like no gitignore and no hidden file filtering is applied). Instead, ripgrep behaves as if you gave the --binary flag for all explicitly given files. This was a fairly invasive change, and potentially increases the UX complexity of ripgrep around binary files. (Before, there were two binary modes, where as now there are three.) However, ripgrep is now a bit louder with warning messages when binary file detection might otherwise be hiding potential matches, so hopefully this is a net improvement. Finally, the `-uuu` convenience now maps to `--no-ignore --hidden --binary`, since this is closer to the actualy intent of the `--unrestricted` flag, i.e., to reduce ripgrep's smart filtering. As a consequence, `rg -uuu foo` should now search roughly the same number of bytes as `grep -r foo`, and `rg -uuua foo` should search roughly the same number of bytes as `grep -ra foo`. (The "roughly" weasel word is used because grep's and ripgrep's binary file detection might differ somewhat---perhaps based on buffer sizes---which can impact exactly what is and isn't searched.) See the numerous tests in tests/binary.rs for intended behavior. Fixes #306, Fixes #855
2019-04-05printer: use bstrAndrew Gallant
This starts the usage of bstr in the printer. We don't use it too much yet, but it comes in handy for implementing PrinterPath and lets us push down some platform specific code into bstr.
2019-01-26regex: make CRLF hack more robustAndrew Gallant
This commit improves the CRLF hack to be more robust. In particular, in addition to rewriting `$` as `(?:\r??$)`, we now strip `\r` from the end of a match if and only if the regex has an ending line anchor required for a match. This doesn't quite make the hack 100% correct, but should fix most use cases in practice. An example of a regex that will still be incorrect is `foo|bar$`, since the analysis isn't quite sophisticated enough to determine that a `\r` can be safely stripped from any match. Even if we fix that, regexes like `foo\r|bar$` still won't be handled correctly. Alas, more work on this front should really be focused on enabling this in the regex engine itself. The specific cause of this bug was that grep-searcher was sneakily stripping CRLF from matching lines when it really shouldn't have. We remove that code now, and instead rely on better match semantics provided at a lower level. Fixes #1095
2019-01-22printer: fix path handling in summarizerMika Dede
This commit fixes a bug where both of the following commands always reported an error: rg --files-with-matches foo file rg --files-without-match foo file In particular, the printer was erroneously respecting the `path` option even the the summary kind was `PathWithMatch` or `PathWithoutMatch`. The documented behavior is that those summary kinds always require a path, and thus, the `path` option has no effect. We fix this by correcting the case analysis. This also fixes a bug where the exit code for `--files-without-match` was not set correctly. We update the printer's `has_match` method to report the correct value. Fixes #1106, Closes #1130
2019-01-19deps: update various dependenciesAndrew Gallant
We also increase the MSRV to 1.32, the current stable release, which sets the stage for migrating to Rust 2018.
2019-01-11grep-printer: add macro docs, reduxAndrew Gallant
2018-09-07deps: update versions for all cratesAndrew Gallant
I don't think every change here is needed, but this ensures we're using the latest version of every direct dependency.
2018-09-07doc: minor touchups to API docsAndrew Gallant
2018-09-07grep-printer: delete unused codeAndrew Gallant
2018-09-07grep-matcher: add LineTerminator::is_suffixAndrew Gallant
This centralizes the logic for checking whether a line has a line terminator or not.
2018-09-04grep-cli: introduce new grep-cli crateAndrew Gallant
This commit moves a lot of "utility" code from ripgrep core into grep-cli. Any one of these things might not be worth creating a new crate, but combining everything together results in a fair number of a convenience routines that make up a decent sized crate. There is potentially more we could move into the crate, but much of what remains in ripgrep core is almost entirely dealing with the number of flags we support. In the course of doing moving things to the grep-cli crate, we clean up a lot of gunk and improve failure modes in a number of cases. In particular, we've fixed a bug where other processes could deadlock if they write too much to stderr. Fixes #990
2018-08-21grep-printer: fix bug in printing truncated linesAndrew Gallant
When emitting color, the printer wasn't checking whether the line exceeded the maximum allowed length.
2018-08-20deps: update libripgrep crate versionsAndrew Gallant
This prepares them for an initial 0.1.0 release.
2018-08-20libripgrep: initial commit introducing libripgrepAndrew Gallant
libripgrep is not any one library, but rather, a collection of libraries that roughly separate the following key distinct phases in a grep implementation: 1. Pattern matching (e.g., by a regex engine). 2. Searching a file using a pattern matcher. 3. Printing results. Ultimately, both (1) and (3) are defined by de-coupled interfaces, of which there may be multiple implementations. Namely, (1) is satisfied by the `Matcher` trait in the `grep-matcher` crate and (3) is satisfied by the `Sink` trait in the `grep2` crate. The searcher (2) ties everything together and finds results using a matcher and reports those results using a `Sink` implementation. Closes #162