Compare commits

...

18 Commits

Author SHA1 Message Date
Andrew Gallant
a6d05475fb ignore-0.4.17 2020-11-23 10:25:33 -05:00
Roey Darwish Dror
020c5453a5 cli: fix stdin detection for Powershell on Unix
It seems that PowerShell uses sockets instead of FIFOs to redirect the
output between commands. So add `is_socket` to our `is_readable_stdin`
check.

This seems unlikely to cause problems and it probably more generally
correct than what we had before. In theory, it could cause problems if
it produces false positives, in which case, ripgrep will try to read
stdin when it should search the current working directory. (And this
usually winds up manifesting as ripgrep blocking forever.) But, if the
stdin handle reports itself as a socket, then it seems like we should
read it.

Fixes #1741, Closes #1742
2020-11-23 10:23:34 -05:00
Ed Page
873abecbf1 ignore: provide underlying IO Error
`ignore::Error` wraps `std::io::Error` with additional information
(as well as expose non-IO errors). For people wanting to inspect what
the error is, they have to recursively match the Enum. This provides
`io_error` and `into_io_error` helpers to do this for the user.

PR #1740
2020-11-23 10:19:31 -05:00
tleb
8c73833efc readme: fix link to .deb
This is a common thing to forget to do after a release.
2020-11-22 09:56:02 -05:00
James Harr
44e69ba627 ignore/types: add yang file type
YANG is described in RFC 6020
https://tools.ietf.org/html/rfc6020

PR #1736
2020-11-20 09:41:29 -05:00
Andrew Gallant
13d77ab646 ci: update to GITHUB_ENV
Apparently ::set-env has been completely disabled. Sigh.
2020-11-16 19:17:36 -05:00
Andrew Gallant
d97fb72d84 doc: update CI links in crate READMEs
I switched to GitHub Actions long ago, which replaces both Travis and
AppVeyor.

Fixes #1732
2020-11-16 19:07:16 -05:00
Andrew Gallant
d6365117e2 doc: sync --help output with man page
The man page had the correct usage hints, but the -h/--help output was
using an older more incorrect version of the hints.

Closes #1730 (again)
2020-11-15 15:27:23 -05:00
Andrew Gallant
f32e906012 doc: clarify that CLI invocation must always be valid
This comes up as a corner case where folks provide -e/--regexp in a
configuration file and then expect to be able to run 'rg' with no args.
However, ripgrep fails because it still expects at least one pattern
even though one was specified in the config file.

This occurs because ripgrep has to parse its CLI parameters before
reading the config file. (For log output settings and to handle the
--no-config flag.) This initial parse will fail if there are no patterns
specified.

The only way to solve this that I can see is to somehow relax the
requirements of the initial parse. But this is problematic because we
would still need to enforce those requirements in cases where we don't
do a second parse (when no config file is present).

All in all, this doesn't seem like a problem that is worth solving.

Closes #1730
2020-11-15 15:00:08 -05:00
Taiki Endo
59644d4592 ci: install cross from crates.io
A new release of cross has been put out, so we
no longer need to install it from git.

PR #1728
2020-11-09 07:25:41 -05:00
Alex Touchet
3ca324fda7 doc: update several links to use https
PR #1724
2020-11-03 10:33:36 -05:00
Stefan VanBuren
8782f8200c doc: add missing backtick in FAQ
PR #1723
2020-11-03 10:32:38 -05:00
Andrew Gallant
2819212f89 printer: tweak binary detection message format
This roughly matches similar changes made in GNU grep recently.
2020-11-02 10:52:51 -05:00
Andrew Gallant
810be0b348 deps: update base64 to 0.13.0 2020-11-02 10:52:51 -05:00
Andrew Gallant
a28bb1e953 deps: bring in all semver updates
This brings in all other semver updates.

This did require updating some tests, since bstr changed its debug
output for NUL bytes to be a bit more idiomatic.
2020-11-02 10:52:51 -05:00
Andrew Gallant
3ef63dacbe deps: targeted update of some dependencies
This updates encoding_rs, crossbeam-utils and crossbeam-channel. This
serves two purposes. The encoding_rs update fixes a compilation failure
on the latest nightly. The crossbeam updates are good sense and to
reduce duplicate dependencies such as cfg-if. (Although, we note that
the log crate still pulls in cfg-if 0.1, so ripgrep has a duplicate
dependency there for now. But it's very small.)

Fixes #1721, Closes #1705
2020-11-02 10:52:51 -05:00
Vanessa McHale
e1ac18ef06 ignore/types: add Futhark
See: https://futhark-lang.org/

PR #1720
2020-10-31 12:10:15 -04:00
Brandon Adams
ba3f9673ad ignore/types: generalize bazel type a bit
Bazel supports `BUILD.bazel` as well as `WORKSPACE.bazel`. In
addition, it is common to ship BUILD/WORKSPACE templates for
external repositories suffixed with .bazel for easier tool
recognition.

Co-authored-by: Brandon Adams <brandon.adams@imc.com>

PR #1716
2020-10-23 12:24:30 -04:00
29 changed files with 242 additions and 157 deletions

View File

@@ -107,12 +107,10 @@ jobs:
- name: Use Cross - name: Use Cross
if: matrix.target != '' if: matrix.target != ''
run: | run: |
# FIXME: to work around bugs in latest cross release, install master. cargo install cross
# See: https://github.com/rust-embedded/cross/issues/357 echo "CARGO=cross" >> $GITHUB_ENV
cargo install --git https://github.com/rust-embedded/cross echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "::set-env name=CARGO::cross" echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}"
echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}"
- name: Show command used for Cargo - name: Show command used for Cargo
run: | run: |

View File

@@ -35,7 +35,7 @@ jobs:
# Apparently, this is the right way to get a tag name. Really? # Apparently, this is the right way to get a tag name. Really?
# #
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "::set-env name=RG_VERSION::${GITHUB_REF#refs/tags/}" echo "RG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RG_VERSION }}" echo "version is: ${{ env.RG_VERSION }}"
- name: Create GitHub release - name: Create GitHub release
@@ -131,12 +131,10 @@ jobs:
- name: Use Cross - name: Use Cross
# if: matrix.os != 'windows-2019' # if: matrix.os != 'windows-2019'
run: | run: |
# FIXME: to work around bugs in latest cross release, install master. cargo install cross
# See: https://github.com/rust-embedded/cross/issues/357 echo "CARGO=cross" >> $GITHUB_ENV
cargo install --git https://github.com/rust-embedded/cross echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "::set-env name=CARGO::cross" echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}"
echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}"
- name: Show command used for Cargo - name: Show command used for Cargo
run: | run: |
@@ -154,10 +152,10 @@ jobs:
shell: bash shell: bash
run: | run: |
release_upload_url="$(cat artifacts/release-upload-url)" release_upload_url="$(cat artifacts/release-upload-url)"
echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
echo "release upload url: $RELEASE_UPLOAD_URL" echo "release upload url: $RELEASE_UPLOAD_URL"
release_version="$(cat artifacts/release-version)" release_version="$(cat artifacts/release-version)"
echo "::set-env name=RELEASE_VERSION::$release_version" echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "release version: $RELEASE_VERSION" echo "release version: $RELEASE_VERSION"
- name: Build release binary - name: Build release binary
@@ -191,13 +189,13 @@ jobs:
if [ "${{ matrix.os }}" = "windows-2019" ]; then if [ "${{ matrix.os }}" = "windows-2019" ]; then
cp "target/${{ matrix.target }}/release/rg.exe" "$staging/" cp "target/${{ matrix.target }}/release/rg.exe" "$staging/"
7z a "$staging.zip" "$staging" 7z a "$staging.zip" "$staging"
echo "::set-env name=ASSET::$staging.zip" echo "ASSET=$staging.zip" >> $GITHUB_ENV
else else
# The man page is only generated on Unix systems. ¯\_(ツ)_/¯ # The man page is only generated on Unix systems. ¯\_(ツ)_/¯
cp "$outdir"/rg.1 "$staging/doc/" cp "$outdir"/rg.1 "$staging/doc/"
cp "target/${{ matrix.target }}/release/rg" "$staging/" cp "target/${{ matrix.target }}/release/rg" "$staging/"
tar czf "$staging.tar.gz" "$staging" tar czf "$staging.tar.gz" "$staging"
echo "::set-env name=ASSET::$staging.tar.gz" echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi fi
- name: Upload release archive - name: Upload release archive

View File

@@ -2,10 +2,25 @@ TBD
=== ===
Unreleased changes. Release notes have not yet been written. Unreleased changes. Release notes have not yet been written.
In this release, a small tweak has been made to the output format when a binary
file is detected. Previously, it looked like this:
```
Binary file FOO matches (found "\0" byte around offset XXX)
```
Now it looks like this:
```
FOO: binary file matches (found "\0" byte around offset XXX)
```
Bug fixes: Bug fixes:
* [BUG #1277](https://github.com/BurntSushi/ripgrep/issues/1277): * [BUG #1277](https://github.com/BurntSushi/ripgrep/issues/1277):
Document cygwin path translation behavior in the FAQ. Document cygwin path translation behavior in the FAQ.
* [BUG #1741](https://github.com/BurntSushi/ripgrep/issues/1741):
Fix stdin detection when using PowerShell in UNIX environments.
12.1.1 (2020-05-29) 12.1.1 (2020-05-29)

160
Cargo.lock generated
View File

@@ -2,9 +2,9 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.10" version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -22,15 +22,15 @@ dependencies = [
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.12.1" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@@ -40,9 +40,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"memchr", "memchr",
@@ -63,9 +63,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.54" version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
dependencies = [ dependencies = [
"jobserver", "jobserver",
] ]
@@ -77,10 +77,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "clap" name = "cfg-if"
version = "2.33.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"strsim", "strsim",
@@ -89,34 +95,41 @@ dependencies = [
] ]
[[package]] [[package]]
name = "crossbeam-channel" name = "const_fn"
version = "0.4.2" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2"
[[package]]
name = "crossbeam-channel"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [ dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils", "crossbeam-utils",
"maybe-uninit",
] ]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.2" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if 1.0.0",
"const_fn",
"lazy_static", "lazy_static",
] ]
[[package]] [[package]]
name = "encoding_rs" name = "encoding_rs"
version = "0.8.23" version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 1.0.0",
"packed_simd", "packed_simd_2",
] ]
[[package]] [[package]]
@@ -136,9 +149,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "fs_extra" name = "fs_extra"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]] [[package]]
name = "glob" name = "glob"
@@ -251,16 +264,16 @@ dependencies = [
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.13" version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
dependencies = [ dependencies = [
"libc", "libc",
] ]
[[package]] [[package]]
name = "ignore" name = "ignore"
version = "0.4.16" version = "0.4.17"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"crossbeam-utils", "crossbeam-utils",
@@ -277,9 +290,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]] [[package]]
name = "jemalloc-sys" name = "jemalloc-sys"
@@ -319,30 +332,30 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.71" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "libm"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.8" version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
] ]
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.3" version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]] [[package]]
name = "memmap" name = "memmap"
@@ -365,12 +378,13 @@ dependencies = [
] ]
[[package]] [[package]]
name = "packed_simd" name = "packed_simd_2"
version = "0.3.3" version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a85ea9fc0d4ac0deb6fe7911d38786b32fc11119afd9e9d38b84ff691ce64220" checksum = "3278e0492f961fd4ae70909f56b2723a7e8d01a228427294e19cdfdebda89a17"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 0.1.10",
"libm",
] ]
[[package]] [[package]]
@@ -398,33 +412,33 @@ dependencies = [
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.17" version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.17" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.6" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.3.9" version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -443,9 +457,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.18" version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
[[package]] [[package]]
name = "ripgrep" name = "ripgrep"
@@ -469,9 +483,9 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.4" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]] [[package]]
name = "same-file" name = "same-file"
@@ -484,15 +498,15 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.110" version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.110" version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -501,9 +515,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.53" version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -518,9 +532,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.27" version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -556,15 +570,15 @@ dependencies = [
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.7" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
@@ -579,9 +593,9 @@ dependencies = [
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.8" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [ dependencies = [
"winapi-i686-pc-windows-gnu", "winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu",

2
FAQ.md
View File

@@ -208,7 +208,7 @@ The `--color` flag accepts one of the following possible values: `never`,
ripgrep to only enable colors when it is printing to a terminal. But if you ripgrep to only enable colors when it is printing to a terminal. But if you
pipe ripgrep to a file or some other process, then it will suppress colors. pipe ripgrep to a file or some other process, then it will suppress colors.
The --colors` flag is a bit more complicated. The general format is: The `--colors` flag is a bit more complicated. The general format is:
``` ```
--colors '{type}:{attribute}:{value}' --colors '{type}:{attribute}:{value}'

View File

@@ -278,8 +278,8 @@ then ripgrep can be installed using a binary `.deb` file provided in each
[ripgrep release](https://github.com/BurntSushi/ripgrep/releases). [ripgrep release](https://github.com/BurntSushi/ripgrep/releases).
``` ```
$ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/11.0.2/ripgrep_11.0.2_amd64.deb $ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep_12.1.1_amd64.deb
$ sudo dpkg -i ripgrep_11.0.2_amd64.deb $ sudo dpkg -i ripgrep_12.1.1_amd64.deb
``` ```
If you run Debian Buster (currently Debian stable) or Debian sid, ripgrep is If you run Debian Buster (currently Debian stable) or Debian sid, ripgrep is
@@ -309,14 +309,14 @@ If you're a **FreeBSD** user, then you can install ripgrep from the
``` ```
If you're an **OpenBSD** user, then you can install ripgrep from the If you're an **OpenBSD** user, then you can install ripgrep from the
[official ports](http://openports.se/textproc/ripgrep): [official ports](https://openports.se/textproc/ripgrep):
``` ```
$ doas pkg_add ripgrep $ doas pkg_add ripgrep
``` ```
If you're a **NetBSD** user, then you can install ripgrep from If you're a **NetBSD** user, then you can install ripgrep from
[pkgsrc](http://pkgsrc.se/textproc/ripgrep): [pkgsrc](https://pkgsrc.se/textproc/ripgrep):
``` ```
# pkgin install ripgrep # pkgin install ripgrep

View File

@@ -99,9 +99,7 @@ is_osx() {
builder() { builder() {
if is_musl && is_x86_64; then if is_musl && is_x86_64; then
# cargo install cross cargo install cross
# To work around https://github.com/rust-embedded/cross/issues/357
cargo install --git https://github.com/rust-embedded/cross --force
echo "cross" echo "cross"
else else
echo "cargo" echo "cargo"

View File

@@ -5,11 +5,10 @@ command line applications. This includes, but is not limited to, parsing hex
escapes, detecting whether stdin is readable and more. To the extent possible, escapes, detecting whether stdin is readable and more. To the extent possible,
this crate strives for compatibility across Windows, macOS and Linux. this crate strives for compatibility across Windows, macOS and Linux.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-cli.svg)](https://crates.io/crates/grep-cli) [![](https://img.shields.io/crates/v/grep-cli.svg)](https://crates.io/crates/grep-cli)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -210,7 +210,7 @@ pub fn is_readable_stdin() -> bool {
Err(_) => return false, Err(_) => return false,
Ok(md) => md.file_type(), Ok(md) => md.file_type(),
}; };
ft.is_file() || ft.is_fifo() ft.is_file() || ft.is_fifo() || ft.is_socket()
} }
#[cfg(windows)] #[cfg(windows)]

View File

@@ -24,10 +24,13 @@ Project home page: https://github.com/BurntSushi/ripgrep
const USAGE: &str = " const USAGE: &str = "
rg [OPTIONS] PATTERN [PATH ...] rg [OPTIONS] PATTERN [PATH ...]
rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...] rg [OPTIONS] -e PATTERN ... [PATH ...]
rg [OPTIONS] -f PATTERNFILE ... [PATH ...]
rg [OPTIONS] --files [PATH ...] rg [OPTIONS] --files [PATH ...]
rg [OPTIONS] --type-list rg [OPTIONS] --type-list
command | rg [OPTIONS] PATTERN"; command | rg [OPTIONS] PATTERN
rg [OPTIONS] --help
rg [OPTIONS] --version";
const TEMPLATE: &str = "\ const TEMPLATE: &str = "\
{bin} {version} {bin} {version}

View File

@@ -4,11 +4,10 @@ Cross platform single glob and glob set matching. Glob set matching is the
process of matching one or more glob patterns against a single candidate path process of matching one or more glob patterns against a single candidate path
simultaneously, and returning all of the globs that matched. simultaneously, and returning all of the globs that matched.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/globset.svg)](https://crates.io/crates/globset) [![](https://img.shields.io/crates/v/globset.svg)](https://crates.io/crates/globset)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -5,7 +5,7 @@ authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """ description = """
Fast line oriented regex searching as a library. Fast line oriented regex searching as a library.
""" """
documentation = "http://burntsushi.net/rustdoc/grep/" documentation = "https://docs.rs/grep"
homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep" homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep"
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep" repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/grep"
readme = "README.md" readme = "README.md"

View File

@@ -2,11 +2,10 @@ grep
---- ----
ripgrep, as a library. ripgrep, as a library.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep.svg)](https://crates.io/crates/grep) [![](https://img.shields.io/crates/v/grep.svg)](https://crates.io/crates/grep)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "ignore" name = "ignore"
version = "0.4.16" #:version version = "0.4.17" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"] authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """ description = """
A fast library for efficiently matching ignore files such as `.gitignore` A fast library for efficiently matching ignore files such as `.gitignore`
@@ -18,7 +18,7 @@ name = "ignore"
bench = false bench = false
[dependencies] [dependencies]
crossbeam-utils = "0.7.0" crossbeam-utils = "0.8.0"
globset = { version = "0.4.5", path = "../globset" } globset = { version = "0.4.5", path = "../globset" }
lazy_static = "1.1" lazy_static = "1.1"
log = "0.4.5" log = "0.4.5"
@@ -32,7 +32,7 @@ walkdir = "2.2.7"
version = "0.1.2" version = "0.1.2"
[dev-dependencies] [dev-dependencies]
crossbeam-channel = "0.4.0" crossbeam-channel = "0.5.0"
[features] [features]
simd-accel = ["globset/simd-accel"] simd-accel = ["globset/simd-accel"]

View File

@@ -4,11 +4,10 @@ The ignore crate provides a fast recursive directory iterator that respects
various filters such as globs, file types and `.gitignore` files. This crate various filters such as globs, file types and `.gitignore` files. This crate
also provides lower level direct access to gitignore and file type matchers. also provides lower level direct access to gitignore and file type matchers.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/ignore.svg)](https://crates.io/crates/ignore) [![](https://img.shields.io/crates/v/ignore.svg)](https://crates.io/crates/ignore)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -21,7 +21,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]), ("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]),
("avro", &["*.avdl", "*.avpr", "*.avsc"]), ("avro", &["*.avdl", "*.avpr", "*.avsc"]),
("awk", &["*.awk"]), ("awk", &["*.awk"]),
("bazel", &["*.bzl", "WORKSPACE", "BUILD", "BUILD.bazel"]), ("bazel", &["*.bazel", "*.bzl", "BUILD", "WORKSPACE"]),
("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]), ("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
("brotli", &["*.br"]), ("brotli", &["*.br"]),
("buildstream", &["*.bst"]), ("buildstream", &["*.bst"]),
@@ -68,6 +68,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
"*.f90", "*.F90", "*.f95", "*.F95", "*.f90", "*.F90", "*.f95", "*.F95",
]), ]),
("fsharp", &["*.fs", "*.fsx", "*.fsi"]), ("fsharp", &["*.fs", "*.fsx", "*.fsi"]),
("fut", &[".fut"]),
("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]), ("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
("gn", &["*.gn", "*.gni"]), ("gn", &["*.gn", "*.gni"]),
("go", &["*.go"]), ("go", &["*.go"]),
@@ -240,6 +241,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("xz", &["*.xz", "*.txz"]), ("xz", &["*.xz", "*.txz"]),
("yacc", &["*.y"]), ("yacc", &["*.y"]),
("yaml", &["*.yaml", "*.yml"]), ("yaml", &["*.yaml", "*.yml"]),
("yang", &["*.yang"]),
("z", &["*.Z"]), ("z", &["*.Z"]),
("zig", &["*.zig"]), ("zig", &["*.zig"]),
("zsh", &[ ("zsh", &[

View File

@@ -196,6 +196,71 @@ impl Error {
} }
} }
/// Inspect the original [`io::Error`] if there is one.
///
/// [`None`] is returned if the [`Error`] doesn't correspond to an
/// [`io::Error`]. This might happen, for example, when the error was
/// produced because a cycle was found in the directory tree while
/// following symbolic links.
///
/// This method returns a borrowed value that is bound to the lifetime of the [`Error`]. To
/// obtain an owned value, the [`into_io_error`] can be used instead.
///
/// > This is the original [`io::Error`] and is _not_ the same as
/// > [`impl From<Error> for std::io::Error`][impl] which contains additional context about the
/// error.
///
/// [`None`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#variant.None
/// [`io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
/// [`From`]: https://doc.rust-lang.org/stable/std/convert/trait.From.html
/// [`Error`]: struct.Error.html
/// [`into_io_error`]: struct.Error.html#method.into_io_error
/// [impl]: struct.Error.html#impl-From%3CError%3E
pub fn io_error(&self) -> Option<&std::io::Error> {
match *self {
Error::Partial(ref errs) => {
if errs.len() == 1 {
errs[0].io_error()
} else {
None
}
}
Error::WithLineNumber { ref err, .. } => err.io_error(),
Error::WithPath { ref err, .. } => err.io_error(),
Error::WithDepth { ref err, .. } => err.io_error(),
Error::Loop { .. } => None,
Error::Io(ref err) => Some(err),
Error::Glob { .. } => None,
Error::UnrecognizedFileType(_) => None,
Error::InvalidDefinition => None,
}
}
/// Similar to [`io_error`] except consumes self to convert to the original
/// [`io::Error`] if one exists.
///
/// [`io_error`]: struct.Error.html#method.io_error
/// [`io::Error`]: https://doc.rust-lang.org/stable/std/io/struct.Error.html
pub fn into_io_error(self) -> Option<std::io::Error> {
match self {
Error::Partial(mut errs) => {
if errs.len() == 1 {
errs.remove(0).into_io_error()
} else {
None
}
}
Error::WithLineNumber { err, .. } => err.into_io_error(),
Error::WithPath { err, .. } => err.into_io_error(),
Error::WithDepth { err, .. } => err.into_io_error(),
Error::Loop { .. } => None,
Error::Io(err) => Some(err),
Error::Glob { .. } => None,
Error::UnrecognizedFileType(_) => None,
Error::InvalidDefinition => None,
}
}
/// Returns a depth associated with recursively walking a directory (if /// Returns a depth associated with recursively walking a directory (if
/// this error was generated from a recursive directory iterator). /// this error was generated from a recursive directory iterator).
pub fn depth(&self) -> Option<usize> { pub fn depth(&self) -> Option<usize> {

View File

@@ -4,11 +4,10 @@ This crate provides a low level interface for describing regular expression
matchers. The `grep` crate uses this interface in order to make the regex matchers. The `grep` crate uses this interface in order to make the regex
engine it uses pluggable. engine it uses pluggable.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-matcher.svg)](https://crates.io/crates/grep-matcher) [![](https://img.shields.io/crates/v/grep-matcher.svg)](https://crates.io/crates/grep-matcher)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -4,11 +4,10 @@ The `grep-pcre2` crate provides an implementation of the `Matcher` trait from
the `grep-matcher` crate. This implementation permits PCRE2 to be used in the the `grep-matcher` crate. This implementation permits PCRE2 to be used in the
`grep` crate for fast line oriented searching. `grep` crate for fast line oriented searching.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-pcre2.svg)](https://crates.io/crates/grep-pcre2) [![](https://img.shields.io/crates/v/grep-pcre2.svg)](https://crates.io/crates/grep-pcre2)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -18,7 +18,7 @@ default = ["serde1"]
serde1 = ["base64", "serde", "serde_derive", "serde_json"] serde1 = ["base64", "serde", "serde_derive", "serde_json"]
[dependencies] [dependencies]
base64 = { version = "0.12.1", optional = true } base64 = { version = "0.13.0", optional = true }
bstr = "0.2.0" bstr = "0.2.0"
grep-matcher = { version = "0.1.2", path = "../matcher" } grep-matcher = { version = "0.1.2", path = "../matcher" }
grep-searcher = { version = "0.1.4", path = "../searcher" } grep-searcher = { version = "0.1.4", path = "../searcher" }

View File

@@ -3,11 +3,10 @@ grep-printer
Print results from line oriented searching in a human readable, aggregate or Print results from line oriented searching in a human readable, aggregate or
JSON Lines format. JSON Lines format.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-printer.svg)](https://crates.io/crates/grep-printer) [![](https://img.shields.io/crates/v/grep-printer.svg)](https://crates.io/crates/grep-printer)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -112,7 +112,7 @@ impl JSONBuilder {
/// ///
/// ## Overview /// ## Overview
/// ///
/// The format of this printer is the [JSON Lines](http://jsonlines.org/) /// The format of this printer is the [JSON Lines](https://jsonlines.org/)
/// format. Specifically, this printer emits a sequence of messages, where /// format. Specifically, this printer emits a sequence of messages, where
/// each message is encoded as a single JSON value on a single line. There are /// each message is encoded as a single JSON value on a single line. There are
/// four different types of messages (and this number may expand over time): /// four different types of messages (and this number may expand over time):

View File

@@ -13,7 +13,7 @@ statistics.
The [`JSON`](struct.JSON.html) printer shows results in a machine readable The [`JSON`](struct.JSON.html) printer shows results in a machine readable
format. To facilitate a stream of search results, the format uses format. To facilitate a stream of search results, the format uses
[JSON Lines](http://jsonlines.org/) [JSON Lines](https://jsonlines.org/)
by emitting a series of messages as search results are found. by emitting a series of messages as search results are found.
The [`Summary`](struct.Summary.html) printer shows *aggregate* results for a The [`Summary`](struct.Summary.html) printer shows *aggregate* results for a

View File

@@ -1358,25 +1358,24 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
let bin = self.searcher.binary_detection(); let bin = self.searcher.binary_detection();
if let Some(byte) = bin.quit_byte() { if let Some(byte) = bin.quit_byte() {
self.write(b"WARNING: stopped searching binary file ")?;
if let Some(path) = self.path() { if let Some(path) = self.path() {
self.write_spec(self.config().colors.path(), path.as_bytes())?; self.write_spec(self.config().colors.path(), path.as_bytes())?;
self.write(b" ")?; self.write(b": ")?;
} }
let remainder = format!( let remainder = format!(
"after match (found {:?} byte around offset {})\n", "WARNING: stopped searching binary file after match \
(found {:?} byte around offset {})\n",
[byte].as_bstr(), [byte].as_bstr(),
offset, offset,
); );
self.write(remainder.as_bytes())?; self.write(remainder.as_bytes())?;
} else if let Some(byte) = bin.convert_byte() { } else if let Some(byte) = bin.convert_byte() {
self.write(b"Binary file ")?;
if let Some(path) = self.path() { if let Some(path) = self.path() {
self.write_spec(self.config().colors.path(), path.as_bytes())?; self.write_spec(self.config().colors.path(), path.as_bytes())?;
self.write(b" ")?; self.write(b": ")?;
} }
let remainder = format!( let remainder = format!(
"matches (found {:?} byte around offset {})\n", "binary file matches (found {:?} byte around offset {})\n",
[byte].as_bstr(), [byte].as_bstr(),
offset, offset,
); );

View File

@@ -4,11 +4,10 @@ The `grep-regex` crate provides an implementation of the `Matcher` trait from
the `grep-matcher` crate. This implementation permits Rust's regex engine to the `grep-matcher` crate. This implementation permits Rust's regex engine to
be used in the `grep` crate for fast line oriented searching. be used in the `grep` crate for fast line oriented searching.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-regex.svg)](https://crates.io/crates/grep-regex) [![](https://img.shields.io/crates/v/grep-regex.svg)](https://crates.io/crates/grep-regex)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -5,11 +5,10 @@ things like reporting contextual lines, counting lines, inverting a search,
detecting binary data, automatic UTF-16 transcoding and deciding whether or not detecting binary data, automatic UTF-16 transcoding and deciding whether or not
to use memory maps. to use memory maps.
[![Linux build status](https://api.travis-ci.org/BurntSushi/ripgrep.svg)](https://travis-ci.org/BurntSushi/ripgrep) [![Build status](https://github.com/BurntSushi/ripgrep/workflows/ci/badge.svg)](https://github.com/BurntSushi/ripgrep/actions)
[![Windows build status](https://ci.appveyor.com/api/projects/status/github/BurntSushi/ripgrep?svg=true)](https://ci.appveyor.com/project/BurntSushi/ripgrep)
[![](https://img.shields.io/crates/v/grep-searcher.svg)](https://crates.io/crates/grep-searcher) [![](https://img.shields.io/crates/v/grep-searcher.svg)](https://crates.io/crates/grep-searcher)
Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org). Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation ### Documentation

View File

@@ -191,10 +191,12 @@ simple. It is defined by two rules:
whitespace) are ignored. whitespace) are ignored.
ripgrep will look for a single configuration file if and only if the 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_CONFIG_PATH* environment variable is set and is non-empty. ripgrep
ripgrep will parse shell arguments from this file on startup and will will parse shell arguments from this file on startup and will behave as if
behave as if the arguments in this file were prepended to any explicit the arguments in this file were prepended to any explicit arguments given to
arguments given to ripgrep on the command line. ripgrep on the command line. Note though that the 'rg' command you run must
still be valid. That is, it must always contain at least one pattern at the
command line, even if the configuration file uses the '-e/--regexp' flag.
For example, if your ripgreprc file contained a single line: For example, if your ripgreprc file contained a single line:

View File

@@ -40,7 +40,7 @@ rgtest!(after_match1_implicit, |dir: Dir, mut cmd: TestCommand| {
let expected = "\ let expected = "\
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
WARNING: stopped searching binary file hay after match (found \"\\u{0}\" byte around offset 9741) hay: WARNING: stopped searching binary file after match (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -53,7 +53,7 @@ rgtest!(after_match1_explicit, |dir: Dir, mut cmd: TestCommand| {
let expected = "\ let expected = "\
1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle 1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
Binary file matches (found \"\\u{0}\" byte around offset 9741) binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -64,7 +64,7 @@ rgtest!(after_match1_stdin, |_: Dir, mut cmd: TestCommand| {
let expected = "\ let expected = "\
1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle 1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
Binary file matches (found \"\\u{0}\" byte around offset 9741) binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.pipe(HAY)); eqnice!(expected, cmd.pipe(HAY));
}); });
@@ -85,7 +85,7 @@ rgtest!(after_match1_implicit_binary, |dir: Dir, mut cmd: TestCommand| {
let expected = "\ let expected = "\
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
Binary file hay matches (found \"\\u{0}\" byte around offset 9741) hay: binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -200,7 +200,7 @@ rgtest!(after_match2_implicit, |dir: Dir, mut cmd: TestCommand| {
let expected = "\ let expected = "\
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
WARNING: stopped searching binary file hay after match (found \"\\u{0}\" byte around offset 9741) hay: WARNING: stopped searching binary file after match (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -240,7 +240,7 @@ rgtest!(before_match1_explicit, |dir: Dir, mut cmd: TestCommand| {
cmd.args(&["--no-mmap", "-n", "Heaven", "hay"]); cmd.args(&["--no-mmap", "-n", "Heaven", "hay"]);
let expected = "\ let expected = "\
Binary file matches (found \"\\u{0}\" byte around offset 9741) binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -253,7 +253,7 @@ rgtest!(before_match1_implicit_binary, |dir: Dir, mut cmd: TestCommand| {
cmd.args(&["--no-mmap", "-n", "--binary", "Heaven", "-g", "hay"]); cmd.args(&["--no-mmap", "-n", "--binary", "Heaven", "-g", "hay"]);
let expected = "\ let expected = "\
Binary file hay matches (found \"\\u{0}\" byte around offset 9741) hay: binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -288,7 +288,7 @@ rgtest!(before_match2_explicit, |dir: Dir, mut cmd: TestCommand| {
cmd.args(&["--no-mmap", "-n", "a medical student", "hay"]); cmd.args(&["--no-mmap", "-n", "a medical student", "hay"]);
let expected = "\ let expected = "\
Binary file matches (found \"\\u{0}\" byte around offset 9741) binary file matches (found \"\\0\" byte around offset 9741)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });

View File

@@ -788,7 +788,7 @@ rgtest!(unrestricted3, |dir: Dir, mut cmd: TestCommand| {
cmd.arg("-uuu").arg("foo"); cmd.arg("-uuu").arg("foo");
let expected = "\ let expected = "\
Binary file hay matches (found \"\\u{0}\" byte around offset 3) hay: binary file matches (found \"\\0\" byte around offset 3)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -1001,7 +1001,7 @@ rgtest!(binary_convert, |dir: Dir, mut cmd: TestCommand| {
cmd.arg("--no-mmap").arg("foo").arg("file"); cmd.arg("--no-mmap").arg("foo").arg("file");
let expected = "\ let expected = "\
Binary file matches (found \"\\u{0}\" byte around offset 3) binary file matches (found \"\\0\" byte around offset 3)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });
@@ -1011,7 +1011,7 @@ rgtest!(binary_convert_mmap, |dir: Dir, mut cmd: TestCommand| {
cmd.arg("--mmap").arg("foo").arg("file"); cmd.arg("--mmap").arg("foo").arg("file");
let expected = "\ let expected = "\
Binary file matches (found \"\\u{0}\" byte around offset 3) binary file matches (found \"\\0\" byte around offset 3)
"; ";
eqnice!(expected, cmd.stdout()); eqnice!(expected, cmd.stdout());
}); });