mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-03 05:32:04 -07:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
263e2b012f | ||
|
b80a986721 | ||
|
8a91d3132f | ||
|
525d051172 | ||
|
5a9883d27c | ||
|
f462d092e7 | ||
|
fe84928c85 | ||
|
f7eaf67fc3 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1,6 +1,6 @@
|
|||||||
[root]
|
[root]
|
||||||
name = "ripgrep"
|
name = "ripgrep"
|
||||||
version = "0.1.10"
|
version = "0.1.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"docopt 0.6.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 0.6.83 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ripgrep"
|
name = "ripgrep"
|
||||||
version = "0.1.10" #:version
|
version = "0.1.13" #:version
|
||||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||||
description = """
|
description = """
|
||||||
Line oriented search tool using Rust's regex library. Combines the raw
|
Line oriented search tool using Rust's regex library. Combines the raw
|
||||||
|
@@ -87,8 +87,7 @@ Summarizing, `ripgrep` is fast because:
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
N.B. `ripgrep` is not yet available in any package repositories. I'd like to
|
The binary name for `ripgrep` is `rg`.
|
||||||
fix that in the future.
|
|
||||||
|
|
||||||
[Binaries for `ripgrep` are available for Windows, Mac and
|
[Binaries for `ripgrep` are available for Windows, Mac and
|
||||||
Linux.](https://github.com/BurntSushi/ripgrep/releases) Linux binaries are
|
Linux.](https://github.com/BurntSushi/ripgrep/releases) Linux binaries are
|
||||||
@@ -99,7 +98,7 @@ but you'll need to have the
|
|||||||
Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
|
Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
|
||||||
installed.
|
installed.
|
||||||
|
|
||||||
If you're a `brew` user, then you can install it with a custom formula
|
If you're a **Homebrew** user, then you can install it with a custom formula
|
||||||
(N.B. `ripgrep` isn't actually in Homebrew yet. This just installs the binary
|
(N.B. `ripgrep` isn't actually in Homebrew yet. This just installs the binary
|
||||||
directly):
|
directly):
|
||||||
|
|
||||||
@@ -107,12 +106,22 @@ directly):
|
|||||||
$ brew install https://raw.githubusercontent.com/BurntSushi/ripgrep/master/pkg/brew/ripgrep.rb
|
$ brew install https://raw.githubusercontent.com/BurntSushi/ripgrep/master/pkg/brew/ripgrep.rb
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're a Rust programmer, `ripgrep` can be installed with `cargo`:
|
If you're an **Archlinux** user, then you can install `ripgrep` from the
|
||||||
|
[`ripgrep` AUR package](https://aur.archlinux.org/packages/ripgrep/), e.g.,
|
||||||
|
|
||||||
|
```
|
||||||
|
$ yaourt -S ripgrep
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're a **Rust programmer**, `ripgrep` can be installed with `cargo`:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cargo install ripgrep
|
$ cargo install ripgrep
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`ripgrep` isn't currently in any other package repositories.
|
||||||
|
[I'd like to change that](https://github.com/BurntSushi/ripgrep/issues/10).
|
||||||
|
|
||||||
### Whirlwind tour
|
### Whirlwind tour
|
||||||
|
|
||||||
The command line usage of `ripgrep` doesn't differ much from other tools that
|
The command line usage of `ripgrep` doesn't differ much from other tools that
|
||||||
|
@@ -52,7 +52,7 @@ deploy:
|
|||||||
# channel to use to produce the release artifacts
|
# channel to use to produce the release artifacts
|
||||||
# NOTE make sure you only release *once* per target
|
# NOTE make sure you only release *once* per target
|
||||||
# TODO you may want to pick a different channel
|
# TODO you may want to pick a different channel
|
||||||
CHANNEL: nightly
|
CHANNEL: stable
|
||||||
appveyor_repo_tag: true
|
appveyor_repo_tag: true
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
|
14
ci/sha256.sh
14
ci/sha256.sh
@@ -1,15 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ $# != 1 ]; then
|
if [ $# != 1 ]; then
|
||||||
echo "Usage: $(basename $0) version" >&2
|
echo "Usage: $(basename $0) version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
version="$1"
|
version="$1"
|
||||||
|
|
||||||
|
# Linux and Darwin builds.
|
||||||
for arch in i686 x86_64; do
|
for arch in i686 x86_64; do
|
||||||
for target in apple-darwin unknown-linux-musl; do
|
for target in apple-darwin unknown-linux-musl; do
|
||||||
url="https://github.com/BurntSushi/ripgrep/releases/download/$version/ripgrep-$version-$arch-$target.tar.gz"
|
url="https://github.com/BurntSushi/ripgrep/releases/download/$version/ripgrep-$version-$arch-$target.tar.gz"
|
||||||
sha=$(curl -L -s "$url" | sha256sum)
|
sha=$(curl -sfSL "$url" | sha256sum)
|
||||||
echo $version-$arch-$target $sha
|
echo "$version-$arch-$target $sha"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Source.
|
||||||
|
for ext in zip tar.gz; do
|
||||||
|
url="https://github.com/BurntSushi/ripgrep/archive/$version.$ext"
|
||||||
|
sha=$(curl -sfSL "$url" | sha256sum)
|
||||||
|
echo "source.$ext $sha"
|
||||||
|
done
|
||||||
|
35
pkg/archlinux/PKGBUILD
Normal file
35
pkg/archlinux/PKGBUILD
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Contributor: Andrew Gallant <jamslam@gmail.com>
|
||||||
|
# Maintainer: Andrew Gallant
|
||||||
|
pkgname=ripgrep
|
||||||
|
pkgver=0.1.11
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="A search tool that combines the usability of The Silver Searcher with the raw speed of grep."
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="https://github.com/BurntSushi/ripgrep"
|
||||||
|
license=('UNLICENSE')
|
||||||
|
makedepends=('cargo')
|
||||||
|
source=("https://github.com/BurntSushi/$pkgname/archive/$pkgver.tar.gz")
|
||||||
|
sha256sums=('d29beb1a43a263d75ce4ef23a07253ed6ea306b14ffb5b37bc4972fb5d98238c')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$pkgname-$pkgver"
|
||||||
|
if command -v rustup > /dev/null 2>&1; then
|
||||||
|
RUSTFLAGS="-C target-cpu=native" rustup run nightly \
|
||||||
|
cargo build --release --features simd-accel
|
||||||
|
elif rustc --version | grep -q nightly; then
|
||||||
|
RUSTFLAGS="-C target-cpu=native" \
|
||||||
|
cargo build --release --features simd-accel
|
||||||
|
else
|
||||||
|
cargo build --release
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$pkgname-$pkgver"
|
||||||
|
|
||||||
|
install -Dm755 "target/release/rg" "$pkgdir/usr/bin/rg"
|
||||||
|
install -Dm644 "README-NEW.md" "$pkgdir/usr/share/doc/ripgrep/README.md"
|
||||||
|
install -Dm644 "COPYING" "$pkgdir/usr/share/doc/ripgrep/COPYING"
|
||||||
|
install -Dm644 "LICENSE-MIT" "$pkgdir/usr/share/doc/ripgrep/LICENSE-MIT"
|
||||||
|
install -Dm644 "UNLICENSE" "$pkgdir/usr/share/doc/ripgrep/UNLICENSE"
|
||||||
|
}
|
@@ -131,7 +131,7 @@ Less common options:
|
|||||||
--mmap
|
--mmap
|
||||||
Search using memory maps when possible. This is enabled by default
|
Search using memory maps when possible. This is enabled by default
|
||||||
when ripgrep thinks it will be faster. (Note that mmap searching
|
when ripgrep thinks it will be faster. (Note that mmap searching
|
||||||
doesn't current support the various context related options.)
|
doesn't currently support the various context related options.)
|
||||||
|
|
||||||
--no-mmap
|
--no-mmap
|
||||||
Never use memory maps, even when they might be faster.
|
Never use memory maps, even when they might be faster.
|
||||||
@@ -273,6 +273,9 @@ impl RawArgs {
|
|||||||
false
|
false
|
||||||
} else if self.flag_mmap {
|
} else if self.flag_mmap {
|
||||||
true
|
true
|
||||||
|
} else if cfg!(windows) {
|
||||||
|
// On Windows, memory maps appear faster than read calls. Neat.
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
// If we're only searching a few paths and all of them are
|
// If we're only searching a few paths and all of them are
|
||||||
// files, then memory maps are probably faster.
|
// files, then memory maps are probably faster.
|
||||||
|
@@ -550,6 +550,7 @@ sherlock!(unrestricted2, "Sherlock", ".", |wd: WorkDir, mut cmd: Command| {
|
|||||||
assert_eq!(lines, expected);
|
assert_eq!(lines, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
sherlock!(unrestricted3, "foo", ".", |wd: WorkDir, mut cmd: Command| {
|
sherlock!(unrestricted3, "foo", ".", |wd: WorkDir, mut cmd: Command| {
|
||||||
wd.create("file", "foo\x00bar\nfoo\x00baz\n");
|
wd.create("file", "foo\x00bar\nfoo\x00baz\n");
|
||||||
cmd.arg("-uuu");
|
cmd.arg("-uuu");
|
||||||
@@ -558,6 +559,16 @@ sherlock!(unrestricted3, "foo", ".", |wd: WorkDir, mut cmd: Command| {
|
|||||||
assert_eq!(lines, "file:foo\nfile:foo\n");
|
assert_eq!(lines, "file:foo\nfile:foo\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// On Windows, this test uses memory maps, so the NUL bytes don't get replaced.
|
||||||
|
#[cfg(windows)]
|
||||||
|
sherlock!(unrestricted3, "foo", ".", |wd: WorkDir, mut cmd: Command| {
|
||||||
|
wd.create("file", "foo\x00bar\nfoo\x00baz\n");
|
||||||
|
cmd.arg("-uuu");
|
||||||
|
|
||||||
|
let lines: String = wd.stdout(&mut cmd);
|
||||||
|
assert_eq!(lines, "file:foo\x00bar\nfile:foo\x00baz\n");
|
||||||
|
});
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn binary_nosearch() {
|
fn binary_nosearch() {
|
||||||
let wd = WorkDir::new("binary_nosearch");
|
let wd = WorkDir::new("binary_nosearch");
|
||||||
|
Reference in New Issue
Block a user