1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-23 12:44:01 +02:00
Commit Graph

1266 Commits

Author SHA1 Message Date
Andrew Gallant
9e04a8283c changelog 0.3.1 2016-11-21 20:52:42 -05:00
Andrew Gallant
05b26d5986 bump termcolor 2016-11-21 20:33:57 -05:00
Andrew Gallant
506f046b8b termcolor-0.1.1 2016-11-21 20:33:39 -05:00
Andrew Gallant
ae592b11e3 Only emit bold ANSI code if bold is true.
This was a simple logic error. Also, avoid emitting ANSI escape codes
if there are no color settings.

Fixes #242
2016-11-21 20:33:15 -05:00
Andrew Gallant
a5e7f176f1 Use clap ~2.18.0.
This is to ensure that we don't silently update a minor version of clap,
which could include a breaking change.

(An update to 2.19 should be done soon.)
2016-11-21 09:20:43 -05:00
Andrew Gallant
0428bd1bec update brew tap 2016-11-20 19:55:40 -05:00
Andrew Gallant
7f3e7d2faa bsd doesn't have --recursive 2016-11-20 17:57:10 -05:00
Andrew Gallant
8d5906d7fc another attempt to fix deploy 2016-11-20 16:57:20 -05:00
Andrew Gallant
feda38852e fix deploy 2016-11-20 16:40:42 -05:00
Andrew Gallant
59187902d0 Fix completion script deployment bundle. 2016-11-20 16:26:23 -05:00
Andrew Gallant
aef46beaf2 0.3.0 2016-11-20 16:07:25 -05:00
Andrew Gallant
f0e192943f changelog 0.3.0 2016-11-20 16:06:49 -05:00
Andrew Gallant
df72d8d1e0 Make wincolor crate compilable on non-Windows platforms. 2016-11-20 15:44:19 -05:00
Andrew Gallant
d06f84ced3 Get rid of special mmap decision on Windows.
I spent some quality time on my Windows 10 laptop and it appears to
suffer from a similar trade-off as on Linux: mmaps are bad for large
directory traversals but good for single large files.

Darwin continues to reject memory maps in all cases (unless explicitly
requested), but more testing should be done there.
2016-11-20 15:32:50 -05:00
Andrew Gallant
9598331fa8 Propagate no_messages option to worker.
Fixes #241
2016-11-20 15:01:37 -05:00
Andrew Gallant
883d8fc72f Merge pull request #240 from BurntSushi/color
Completely re-work colored output and tty handling.
2016-11-20 15:01:11 -05:00
Andrew Gallant
e8a30cb893 Completely re-work colored output and tty handling.
This commit completely guts all of the color handling code and replaces
most of it with two new crates: wincolor and termcolor. wincolor
provides a simple API to coloring using the Windows console and
termcolor provides a platform independent coloring API tuned for
multithreaded command line programs. This required a lot more
flexibility than what the `term` crate provided, so it was dropped.
We instead switch to writing ANSI escape sequences directly and ignore
the TERMINFO database.

In addition to fixing several bugs, this commit also permits end users
to customize colors to a certain extent. For example, this command will
set the match color to magenta and the line number background to yellow:

    rg --colors 'match:fg:magenta' --colors 'line:bg:yellow' foo

For tty handling, we've adopted a hack from `git` to do tty detection in
MSYS/mintty terminals. As a result, ripgrep should get both color
detection and piping correct on Windows regardless of which terminal you
use.

Finally, switch to line buffering. Performance doesn't seem to be
impacted and it's an otherwise more user friendly option.

Fixes #37, Fixes #51, Fixes #94, Fixes #117, Fixes #182, Fixes #231
2016-11-20 11:14:52 -05:00
Andrew Gallant
03f7605322 Rename --files-without-matches to --files-without-match.
This is to be consistent with grep.
2016-11-19 20:15:41 -05:00
Andrew Gallant
61663e2307 Merge pull request #239 from mernen/files-without-matches
Add --files-without-matches flag.
2016-11-19 20:05:00 -05:00
Daniel Luz
bd3e7eedb1 Add --files-without-matches flag.
Performs the opposite of --files-with-matches: only shows paths of
files that contain zero matches.

Closes #138
2016-11-19 21:48:59 -02:00
Andrew Gallant
1e6c2ac8e3 Merge pull request #238 from jacwah/refactor
`Ignore` refactorings
2016-11-18 23:11:17 -05:00
Andrew Gallant
0302d58eb8 Fix stdin bug with --file.
When `rg -f-` is used, the default search path should be `./` and not
`-`.
2016-11-17 20:48:11 -05:00
Andrew Gallant
e37f783fc0 Fix issue number mixup.
Thanks @bluss!
2016-11-17 20:30:18 -05:00
Andrew Gallant
495e13cc61 Merge pull request #233 from BurntSushi/clap
Switch from Docopt to Clap.
2016-11-17 20:22:16 -05:00
Andrew Gallant
92dc402f7f Switch from Docopt to Clap.
There were two important reasons for the switch:

1. Performance. Docopt does poorly when the argv becomes large, which is
   a reasonable common use case for search tools. (e.g., use with xargs)
2. Better failure modes. Clap knows a lot more about how a particular
   argv might be invalid, and can therefore provide much clearer error
   messages.

While both were important, (1) made it urgent.

Note that since Clap requires at least Rust 1.11, this will in turn
increase the minimum Rust version supported by ripgrep from Rust 1.9 to
Rust 1.11. It is therefore a breaking change, so the soonest release of
ripgrep with Clap will have to be 0.3.

There is also at least one subtle breaking change in real usage.
Previous to this commit, this used to work:

    rg -e -foo

Where this would cause ripgrep to search for the string `-foo`. Clap
currently has problems supporting this use case
(see: https://github.com/kbknapp/clap-rs/issues/742),
but it can be worked around by using this instead:

    rg -e [-]foo

or even

    rg [-]foo

and this still works:

    rg -- -foo

This commit also adds Bash, Fish and PowerShell completion files to the
release, fixes a bug that prevented ripgrep from working on file
paths containing invalid UTF-8 and shows short descriptions in the
output of `-h` but longer descriptions in the output of `--help`.

Fixes #136, Fixes #189, Fixes #210, Fixes #230
2016-11-17 19:53:41 -05:00
Andrew Gallant
a3f5e0c3d5 Use env::home_dir() instead of env::var_os(HOME).
Thanks @steveklabnik!
2016-11-17 16:54:39 -05:00
Andrew Gallant
39e1a0d694 Merge pull request #227 from emk/issue-7
Allow specifying patterns with `-f FILE` and `-f-`
2016-11-15 18:15:05 -05:00
Eric Kidd
e9cd0a1cc3 Allow specifying patterns with -f FILE and -f-
This is a somewhat basic implementation of `-f-` (#7), with unit tests.
Changes include:

1. The internals of the `pattern` function have been refactored to avoid
   code duplication, but there's a lot more we could do.  Right now we
   read the entire pattern list into a `Vec`.
2. There's now a `WorkDir::pipe` command that allows sending standard
   input to `rg` when testing.

Not implemented: aho-corasick.
2016-11-15 13:00:16 -05:00
Andrew Gallant
cc35ae0748 Merge pull request #235 from jinyeow/master
Added elixir to types
2016-11-15 06:36:19 -05:00
Justin Puah
5ee175beaf Added elixir to types 2016-11-15 20:57:38 +11:00
Andrew Gallant
4b18f82899 Disable symlink tests on Windows.
For some reason, these work on AppVeyor but not in other build systems.
Let's just disable them.

See: https://github.com/rust-lang/rust/pull/37149
2016-11-11 06:44:23 -05:00
Andrew Gallant
5462af4434 Pin rustc-serialize to 0.3.19.
See: https://github.com/rust-lang-nursery/rustc-serialize/pull/159
2016-11-09 20:28:58 -05:00
Andrew Gallant
d2e70da040 0.2.9 2016-11-09 19:07:25 -05:00
Andrew Gallant
64dc9b6709 update deps 2016-11-09 18:54:22 -05:00
Andrew Gallant
9ffd4c421f ignore-0.1.5 2016-11-09 18:52:52 -05:00
Andrew Gallant
d862b80afb changelog 0.2.9 2016-11-09 18:52:08 -05:00
Andrew Gallant
5b73dcc8ab Rework parallelism in directory iterator.
Previously, ignore::WalkParallel would invoke the callback for all
*explicitly* given file paths in a single thread, which effectively
meant that `rg pattern foo bar baz ...` didn't actually search foo, bar
and baz in parallel.

The code was structured that way to avoid spinning up workers if no
directory paths were given. The original intention was probably to have
a separate pool of threads responsible for searching, but ripgrep ended
up just reusing the ignore::WalkParallel workers themselves for searching,
and thereby subjected to its sub-par performance in this case.

The code has been restructured so that file paths are sent to the workers,
which brings back parallelism.

Fixes #226
2016-11-09 17:19:40 -05:00
Andrew Gallant
2dce0dc0df Fix a bug with handling --ignore-file.
Namely, passing a directory to --ignore-file caused ripgrep to allocate
memory without bound.

The issue was that I got a bit overzealous with partial error
reporting. Namely, when processing a gitignore file, we should try
to use every pattern even if some patterns are invalid globs (e.g.,
a**b). In the process, I applied the same logic to I/O errors. In this
case, it manifest by attempting to read lines from a directory, which
appears to yield Results forever, where each Result is an error of the
form "you can't read from a directory silly." Since I treated it as a
partial error, ripgrep was just spinning and accruing each error in
memory, which caused the OOM killer to kick in.

Fixes #228
2016-11-09 16:45:23 -05:00
Andrew Gallant
2e5c3c05e8 reword 2016-11-06 19:48:49 -05:00
Andrew Gallant
6884eea2f5 reword 2016-11-06 19:48:17 -05:00
Andrew Gallant
a3a2f0be6a ucg author says it's not a bug per se 2016-11-06 19:45:18 -05:00
Andrew Gallant
f24873c70b Don't ever search directories. 2016-11-06 19:02:14 -05:00
Andrew Gallant
58126ffe15 touchups 2016-11-06 18:51:00 -05:00
Andrew Gallant
17644a76c0 typo 2016-11-06 18:49:07 -05:00
Andrew Gallant
9fc9f368f5 Always search paths given by user.
This permits doing `rg -a test /dev/sda1` for example, where as before
/dev/sda1 was skipped because it wasn't a regular file.
2016-11-06 18:23:50 -05:00
Andrew Gallant
9cab076a72 touchups 2016-11-06 18:04:55 -05:00
Andrew Gallant
7aa9652f3c touchups 2016-11-06 18:02:45 -05:00
Andrew Gallant
7187f61ca8 touchups 2016-11-06 18:01:55 -05:00
Andrew Gallant
f869c58a5a touchups 2016-11-06 17:59:57 -05:00
Andrew Gallant
3538ba3577 Update README with more/updated benchmarks 2016-11-06 17:55:38 -05:00