summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2018-08-20ripgrep: small cleanupsgrep-search-0.1.0grep-regex-0.1.0grep-printer-0.1.0grep-pcre2-0.1.0grep-matcher-0.1.0grep-0.2.0Andrew Gallant
2018-08-20ripgrep: add --no-multiline-dotalldana
2018-08-20ripgrep: fix typos in option descriptionsdana
2018-08-20ripgrep: migrate to libripgrepAndrew Gallant
This commit does the work to delete the old `grep` crate and effectively rewrite most of ripgrep core to use the new libripgrep crates. The new `grep` crate is now a facade that collects the various crates that make up libripgrep. The most complex part of ripgrep core is now arguably the translation between command line parameters and the library options, which is ultimately where we want to be.
2018-07-22ripgrep: when given no patterns, don't matchAndrew Gallant
Generally speaking, ripgrep prevents the case of not having any patterns via its arg parsing. However, it is possible for users to provide a file of patterns via the `-f` flag. If that file is empty, then ripgrep has nothing to search for and therefore should not ever produce any match. One way of fixing this might be to replace the absence of patterns with a pattern that can never match, but this still requires opening and searching through every file, which is quite a waste. Instead, we detect this case explicitly and quit early. Fixes #900
2018-07-22ripgrep: stop early when --files --quiet is usedAndrew Gallant
This commit tweaks the implementation of the --files flag to stop early when --quiet is provided. Fixes #907
2018-07-22ripgrep: don't skip tar archivesAndrew Gallant
This removes logic from the decompressor for skipping tar archives. This logic was originally added under the assumption that we probably want to avoid the cost of reading them. However, this is generally inconsistent with how ripgrep treats files like tar archives: it should search them and do binary detection like normal. Fixes #918
2018-07-22ripgrep: add --no-ignore-global flagAndrew Gallant
This commit adds a new --no-ignore-global flag that permits disabling the use of global gitignore filtering. Global gitignores are generally found in `$HOME/.config/git/ignore`, but its location can be configured via git's `core.excludesFile` option. Closes #934
2018-07-22ripgrep: improve usage documentationAndrew Gallant
This shows an example for reading stdin. Fixes #951
2018-07-22ripgrep: better --path-separator error messageAndrew Gallant
This commit improves the error message when --path-separator fails. Namely, it prints the separator it got and also prints a notice for Windows users for common failure modes. Fixes #957
2018-07-21ripgrep: add --no-pre switchAndrew Gallant
This switch explicitly disables the --pre behavior. An empty string will also disable --pre behavior, but actually utterring an empty flag value is quite awkward, so we provide an explicit switch to do the same thing. Thanks to @c-blake for pointing this out.
2018-07-21ripgrep: replace decoder with encoding_rs_ioAndrew Gallant
This commit mostly moves the transcoder implementation to its own crate: https://github.com/BurntSushi/encoding_rs_io The new crate adds clear documentation and cleans up the implementation to fully implement the contract of io::Read.
2018-07-21ripgrep: reformat --pre warningAndrew Gallant
2018-07-21ripgrep: add warning to --pre flagAndrew Gallant
The --pre flag can result in a pretty large performance penalty, so put a warning in the flag documentation. This warning is important because a flag like this could easily wind up in a user's configuration file.
2018-07-21ripgrep: add --pre flagCharles Blake
The preprocessor flag accepts a command program and executes this program for every input file that is searched. Instead of searching the file directly, ripgrep will instead search the stdout contents of the program. Closes #978, Closes #981
2018-07-21ripgrep: add support for lz4 decompressionKalle Samuels
This uses the lz4 binary for decompression. Closes #898
2018-06-25ripgrep: rename --maxdepth to --max-depthdana
We keep the old `--maxdepth` spelling to preserve backward compatibility. PR #967
2018-06-25ripgrep: add --fixed-strings flagdana
Fixes #964 PR #965
2018-06-23ripgrep/printer: fix small performance regressionAndrew Gallant
This commit removes an unconditional extra regex search that is in fact not always necessary. This can result in a 2x performance improvement in cases where ripgrep reports many matches. The fix itself isn't ideal, but we continue to punt on cleaning up the printer until it is rewritten for libripgrep, which is happening Real Soon Now. Fixes #955
2018-06-23ripgrep: use new BufferedStandardStream from termcolorAndrew Gallant
Specifically, this will use a buffered writer when not printing to a tty. This fixes a long standing performance regression where ripgrep would slow down dramatically if it needed to report a lot of matches. Fixes #955
2018-06-19ripgrep: use exit code 2 to indicate errorJon Surrell
Exit code 1 was shared to indicate both "no results" and "error." Use status code 2 to indicate errors, similar to grep's behavior. Fixes #948 PR #954
2018-04-23output: remove unnecessary mut bindingAndrew Gallant
2018-04-23output: remove --line-number-width flagAndrew Gallant
This commit does what no software project has ever done before: we've outright removed a flag with no possible way to recapture its functionality. This flag presents numerous problems in that it never really worked well in the first place, and completely falls over when ripgrep uses the --no-heading output format. Well meaning users want ripgrep to fix this by getting into the alignment business by buffering all output, but that is a line that I refuse to cross. Fixes #795
2018-04-23output: add --no-column flagAndrew Gallant
This disables columns in the output if they were otherwise enabled. Fixes #880
2018-04-23logging: add new --no-ignore-messages flagAndrew Gallant
The new --no-ignore-messages flag permits suppressing errors related to parsing .gitignore or .ignore files. These error messages can be somewhat annoying since they can surface from repositories that one has no control over. Fixes #646
2018-04-23doc: more specific docs for --no-messagesAndrew Gallant
This makes it clear that the --no-messages flag doesn't actually suppress all error messages, and is therefore not equivalent to redirecting stderr to /dev/null. See also: #860
2018-03-13grep: upgrade to regex-syntax 0.5Andrew Gallant
This update brings with it many bug fixes: * Better error messages are printed overall. We also include explicit call out for unsupported features like backreferences and look-around. * Regexes like `\s*{` no longer emit incomprehensible errors. * Unicode escape sequences, such as `\u{..}` are now supported. For the most part, this upgrade was done in a straight-forward way. We resist the urge to refactor the `grep` crate, in anticipation of it being rewritten anyway. Note that we removed the `--fixed-strings` suggestion whenever a regex syntax error occurs. In practice, I've found that it results in a lot of false positives, and I believe that its use is not as paramount now that regex parse errors are much more readable. Closes #268, Closes #395, Closes #702, Closes #853
2018-03-12deps: update regex crateAndrew Gallant
This update brings with it a new feature of the regex crate which will now use SIMD optimizations automatically at runtime with no necessary compile time flags. All that's needed is to enable the `unstable` feature. Other crates, such as bytecount and encoding_rs, are still using the old-style SIMD support, so we leave the simd-accel and avx-accel features. However, the binaries we distribute on Github no longer have those features enabled, which makes them truly portable. Fixes #135
2018-03-10output: add --stats flagBalaji Sivaraman
This commit provides basic support for a --stats flag, which will print various aggregate statistics about a search after all of the results have been printed. This is mostly intended to support a similar feature found in the Silver Searcher. Note though that we don't emit the total bytes searched; this is a first pass at an implementation and we can improve upon it later. Closes #411, Closes #799
2018-03-10args: treat --count --only-matching as --count-matchesAndrew Gallant
Namely, when ripgrep is asked to count things and is also asked to print every match on its own line, then we should just automatically count the matches and not the lines. This is a departure from how GNU grep behaves, but there is a compelling argument to be made that GNU grep's behavior doesn't make a lot of sense. Note that since this changes the behavior of combining two existing flags, this is a breaking change.
2018-03-10search: add a --count-matches flagBalaji Sivaraman
This commit introduces a new flag, --count-matches, which will cause ripgrep to report a total count of all matches instead of a count of total lines matched. Closes #566, Closes #814
2018-03-10cleanup: rename match_count to match_line_countBalaji Sivaraman
2018-03-10search: add -b/--byte-offset flagBalaji Sivaraman
This commit adds support for printing 0-based byte offset before each line. We handle corner cases such as `-o/--only-matching` and `-C/--context` as well. Closes #812
2018-03-10mmap: handle ENOMEM errorAndrew Gallant
This commit causes a memory map strategy to fall back to a file backed strategy if the mmap call fails with an `ENOMEM` error. Fixes #852
2018-02-23doc: use PATTERNFILE for -f/--file flagAndrew Gallant
Fixes #832
2018-02-20termcolor: add underline supportBalaji Sivaraman
This commit adds underline support to the termcolor crate, and exposes it through ripgrep. Fixes #798
2018-02-18doc: clarify --ignore-file flagCosmin Lehene
Fixes #684
2018-02-17doc: fix files-with-matches typoUwe Dauernheim
2018-02-10doc: fix asciidoc->man formattingAndrew Gallant
2018-02-10doc: add color FAQ entriesAndrew Gallant
This commit adds FAQ entries about how to configure ripgrep's coloring, and how to get true color support in Windows consoles.
2018-02-10termcolor: permit hex colorsAndrew Gallant
This commit adds support for specifying Ansi256 or RGB colors using hexadecimal notation.
2018-02-10doc: overhaul documentationAndrew Gallant
This commit cleans up the README and splits portions of it out into a user guide (GUIDE.md) and a FAQ (FAQ.md). The README now provides a small list of documentation "quick" links to various parts of the docs. This commit also does a few other minor touchups.
2018-02-10doc: clarify --files-without-matchAndrew Gallant
This adds a couple common keywords to the documentation. Fixes #779
2018-02-06argv: add several hidden flagsAndrew Gallant
This adds hidden counter-flags for the following: -L/--follow [--no-follow] --hidden [--no-hidden] --no-ignore [--ignore] --no-ignore-parent [--ignore-parent] --no-ignore-vcs [--ignore-vcs] --no-messages [--messages] --search-zip [--no-search-zip] --sort-files [--no-sort-files] --text [--no-text] In the above list, the counter-flags are in brackets. While these flags are hidden, we document the counter-flags in the documentation for the flags they are countering.
2018-02-06argv: support hidden flagsAndrew Gallant
This commit adds support for hidden flags. The purpose of hidden flags is for things that end users likely won't need unless they have a configuration file that disables ripgrep's defaults. These flags will provide a way to re-enable ripgrep's defaults.
2018-02-06doc: generate man pageAndrew Gallant
This commit uses the recent refactoring for defining flags to automatically generate a man page. This finally allows us to define the documentation for each flag in a single place. The man page is generated on every build, if and only if `asciidoc` is installed. When generated, it is placed in Cargo's `OUT_DIR` directory, which is the same place that shell completions live.
2018-02-06argv: tweak the meaning of zeroAndrew Gallant
This commit makes a small tweak to the --max-columns flag. Namely, if the value of the flag is 0, then ripgrep behaves as-if the flag were absent. This is useful in the context of ripgrep reading configuration from the environment. For example, an end user might set --max-columns=150, but we should permit the user to disable this setting when needed. Using -M0 is a nice way to do that. We do this because a zero value for --max-columns isn't particularly meaningful. We do leave the --max-count, --max-filesize and --maxdepth flags alone though, since a zero value for those flags is potentially meaningful. (--max-count even has tests for ripgrep's behavior when given a value of 0.)
2018-02-06argv: update clap to 2.29.4Andrew Gallant
We use the new AppSettings::AllArgsOverrideSelf to permit all flags to be specified multiple times. This removes the need for our previous work-around where we would enable `multiple` for every flag and then just extract the last value when consuming clap's matches. We also add a couple regression tests that ensure repeated switches and flags work as expected.
2018-02-05argv: fix PATTERN typoKevin K
When referencing the PATTERN positional argument, we should use `pattern` and not `PATTERN`. The former is the clap identifier name while the latter is the argument value name.
2018-02-04config: add persistent configurationAndrew Gallant
This commit adds support for reading configuration files that change ripgrep's default behavior. The format of the configuration file is an "rc" style and is very simple. It is defined by two rules: 1. Every line is a shell argument, after trimming ASCII whitespace. 2. Lines starting with '#' (optionally preceded by any amount of ASCII whitespace) are ignored. ripgrep will look for a single configuration file if and only if the RIPGREP_CONFIG_PATH environment variable is set and is non-empty. ripgrep will parse shell arguments from this file on startup and will behave as if the arguments in this file were prepended to any explicit arguments given to ripgrep on the command line. For example, if your ripgreprc file contained a single line: --smart-case then the following command RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo would behave identically to the following command rg --smart-case foo This commit also adds a new flag, --no-config, that when present will suppress any and all support for configuration. This includes any future support for auto-loading configuration files from pre-determined paths (which this commit does not add). Conflicts between configuration files and explicit arguments are handled exactly like conflicts in the same command line invocation. That is, this command: RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo --case-sensitive is exactly equivalent to rg --smart-case foo --case-sensitive in which case, the --case-sensitive flag would override the --smart-case flag. Closes #196