mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
Rename xrep to ripgrep.
This commit is contained in:
parent
0042dce949
commit
a744ec133d
10
Cargo.toml
10
Cargo.toml
@ -1,14 +1,14 @@
|
|||||||
[package]
|
[package]
|
||||||
publish = false
|
publish = false
|
||||||
name = "xrep"
|
name = "ripgrep"
|
||||||
version = "0.1.0" #:version
|
version = "0.1.0" #:version
|
||||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||||
description = """
|
description = """
|
||||||
Line oriented search tool using Rust's regex library.
|
Line oriented search tool using Rust's regex library.
|
||||||
"""
|
"""
|
||||||
documentation = "https://github.com/BurntSushi/xrep"
|
documentation = "https://github.com/BurntSushi/ripgrep"
|
||||||
homepage = "https://github.com/BurntSushi/xrep"
|
homepage = "https://github.com/BurntSushi/ripgrep"
|
||||||
repository = "https://github.com/BurntSushi/xrep"
|
repository = "https://github.com/BurntSushi/ripgrep"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
||||||
license = "Unlicense/MIT"
|
license = "Unlicense/MIT"
|
||||||
@ -16,7 +16,7 @@ license = "Unlicense/MIT"
|
|||||||
[[bin]]
|
[[bin]]
|
||||||
bench = false
|
bench = false
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
name = "xrep"
|
name = "rg"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossbeam = "0.2"
|
crossbeam = "0.2"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
environment:
|
environment:
|
||||||
global:
|
global:
|
||||||
PROJECT_NAME: xrep
|
PROJECT_NAME: rg
|
||||||
matrix:
|
matrix:
|
||||||
# Nightly channel
|
# Nightly channel
|
||||||
- TARGET: i686-pc-windows-gnu
|
- TARGET: i686-pc-windows-gnu
|
||||||
@ -39,7 +39,7 @@ before_deploy:
|
|||||||
# TODO(burntsushi): How can we enable SSSE3 on Windows?
|
# TODO(burntsushi): How can we enable SSSE3 on Windows?
|
||||||
- cargo build --release
|
- cargo build --release
|
||||||
- mkdir staging
|
- mkdir staging
|
||||||
- copy target\release\xrep.exe staging
|
- copy target\release\rg.exe staging
|
||||||
- cd staging
|
- cd staging
|
||||||
# release zipfile will look like 'rust-everywhere-v1.2.3-x86_64-pc-windows-msvc'
|
# release zipfile will look like 'rust-everywhere-v1.2.3-x86_64-pc-windows-msvc'
|
||||||
- 7z a ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip *
|
- 7z a ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip *
|
||||||
|
@ -16,7 +16,7 @@ mk_tarball() {
|
|||||||
|
|
||||||
# TODO update this part to copy the artifacts that make sense for your project
|
# TODO update this part to copy the artifacts that make sense for your project
|
||||||
# NOTE All Cargo build artifacts will be under the 'target/$TARGET/{debug,release}'
|
# NOTE All Cargo build artifacts will be under the 'target/$TARGET/{debug,release}'
|
||||||
cp target/$TARGET/release/xrep $td
|
cp target/$TARGET/release/rg $td
|
||||||
|
|
||||||
pushd $td
|
pushd $td
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ run_test_suite() {
|
|||||||
cargo test --target $TARGET
|
cargo test --target $TARGET
|
||||||
|
|
||||||
# sanity check the file type
|
# sanity check the file type
|
||||||
file target/$TARGET/debug/xrep
|
file target/$TARGET/debug/rg
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -6,9 +6,9 @@ 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 = "https://github.com/BurntSushi/xrep"
|
documentation = "https://github.com/BurntSushi/ripgrep"
|
||||||
homepage = "https://github.com/BurntSushi/xrep"
|
homepage = "https://github.com/BurntSushi/ripgrep"
|
||||||
repository = "https://github.com/BurntSushi/xrep"
|
repository = "https://github.com/BurntSushi/ripgrep"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
||||||
license = "Unlicense/MIT"
|
license = "Unlicense/MIT"
|
||||||
|
32
src/args.rs
32
src/args.rs
@ -28,13 +28,13 @@ use Result;
|
|||||||
/// If you've never heard of Docopt before, see: http://docopt.org
|
/// If you've never heard of Docopt before, see: http://docopt.org
|
||||||
/// (TL;DR: The CLI parser is generated from the usage string below.)
|
/// (TL;DR: The CLI parser is generated from the usage string below.)
|
||||||
const USAGE: &'static str = "
|
const USAGE: &'static str = "
|
||||||
Usage: xrep [options] <pattern> [<path> ...]
|
Usage: rg [options] <pattern> [<path> ...]
|
||||||
xrep [options] --files [<path> ...]
|
rg [options] --files [<path> ...]
|
||||||
xrep [options] --type-list
|
rg [options] --type-list
|
||||||
xrep --help
|
rg --help
|
||||||
xrep --version
|
rg --version
|
||||||
|
|
||||||
xrep is like the silver searcher and grep, but faster than both.
|
rg combines the usability of the silver search with the raw speed of grep.
|
||||||
|
|
||||||
Common options:
|
Common options:
|
||||||
-a, --text Search binary files as if they were text.
|
-a, --text Search binary files as if they were text.
|
||||||
@ -114,14 +114,14 @@ 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 xrep thinks it will be faster. (Note that mmap searching doesn't
|
when ripgrep thinks it will be faster. (Note that mmap searching
|
||||||
current support the various context related options.)
|
doesn't current 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.
|
||||||
|
|
||||||
--no-ignore
|
--no-ignore
|
||||||
Don't respect ignore files (.gitignore, .xrepignore, etc.)
|
Don't respect ignore files (.gitignore, .rgignore, etc.)
|
||||||
|
|
||||||
--no-ignore-parent
|
--no-ignore-parent
|
||||||
Don't respect ignore files in parent directories.
|
Don't respect ignore files in parent directories.
|
||||||
@ -137,7 +137,7 @@ Less common options:
|
|||||||
(capped at 6). [default: 0]
|
(capped at 6). [default: 0]
|
||||||
|
|
||||||
--version
|
--version
|
||||||
Show the version number of xrep and exit.
|
Show the version number of ripgrep and exit.
|
||||||
|
|
||||||
File type management options:
|
File type management options:
|
||||||
--type-list
|
--type-list
|
||||||
@ -152,7 +152,7 @@ File type management options:
|
|||||||
";
|
";
|
||||||
|
|
||||||
/// RawArgs are the args as they are parsed from Docopt. They aren't used
|
/// RawArgs are the args as they are parsed from Docopt. They aren't used
|
||||||
/// directly by the rest of xrep.
|
/// directly by the rest of ripgrep.
|
||||||
#[derive(Debug, RustcDecodable)]
|
#[derive(Debug, RustcDecodable)]
|
||||||
pub struct RawArgs {
|
pub struct RawArgs {
|
||||||
arg_pattern: String,
|
arg_pattern: String,
|
||||||
@ -230,7 +230,7 @@ pub struct Args {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RawArgs {
|
impl RawArgs {
|
||||||
/// Convert arguments parsed into a configuration used by xrep.
|
/// Convert arguments parsed into a configuration used by ripgrep.
|
||||||
fn to_args(&self) -> Result<Args> {
|
fn to_args(&self) -> Result<Args> {
|
||||||
let pattern = {
|
let pattern = {
|
||||||
let pattern =
|
let pattern =
|
||||||
@ -387,7 +387,7 @@ impl Args {
|
|||||||
///
|
///
|
||||||
/// If a CLI usage error occurred, then exit the process and print a usage
|
/// If a CLI usage error occurred, then exit the process and print a usage
|
||||||
/// or error message. Similarly, if the user requested the version of
|
/// or error message. Similarly, if the user requested the version of
|
||||||
/// xrep, then print the version and exit.
|
/// ripgrep, then print the version and exit.
|
||||||
///
|
///
|
||||||
/// Also, initialize a global logger.
|
/// Also, initialize a global logger.
|
||||||
pub fn parse() -> Result<Args> {
|
pub fn parse() -> Result<Args> {
|
||||||
@ -409,7 +409,7 @@ impl Args {
|
|||||||
raw.to_args().map_err(From::from)
|
raw.to_args().map_err(From::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if xrep should print the files it will search and exit
|
/// Returns true if ripgrep should print the files it will search and exit
|
||||||
/// (but not do any actual searching).
|
/// (but not do any actual searching).
|
||||||
pub fn files(&self) -> bool {
|
pub fn files(&self) -> bool {
|
||||||
self.files
|
self.files
|
||||||
@ -518,8 +518,8 @@ impl Args {
|
|||||||
&self.type_defs
|
&self.type_defs
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if xrep should print the type definitions currently loaded
|
/// Returns true if ripgrep should print the type definitions currently
|
||||||
/// and then exit.
|
/// loaded and then exit.
|
||||||
pub fn type_list(&self) -> bool {
|
pub fn type_list(&self) -> bool {
|
||||||
self.type_list
|
self.type_list
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ The motivation for this submodule is performance and portability:
|
|||||||
2. We could shell out to a `git` sub-command like ls-files or status, but it
|
2. We could shell out to a `git` sub-command like ls-files or status, but it
|
||||||
seems better to not rely on the existence of external programs for a search
|
seems better to not rely on the existence of external programs for a search
|
||||||
tool. Besides, we need to implement this logic anyway to support things like
|
tool. Besides, we need to implement this logic anyway to support things like
|
||||||
an .xrepignore file.
|
an .rgignore file.
|
||||||
|
|
||||||
The key implementation detail here is that a single gitignore file is compiled
|
The key implementation detail here is that a single gitignore file is compiled
|
||||||
into a single RegexSet, which can be used to report which globs match a
|
into a single RegexSet, which can be used to report which globs match a
|
||||||
@ -379,7 +379,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const ROOT: &'static str = "/home/foobar/rust/xrep";
|
const ROOT: &'static str = "/home/foobar/rust/rg";
|
||||||
|
|
||||||
ignored!(ig1, ROOT, "months", "months");
|
ignored!(ig1, ROOT, "months", "months");
|
||||||
ignored!(ig2, ROOT, "*.lock", "Cargo.lock");
|
ignored!(ig2, ROOT, "*.lock", "Cargo.lock");
|
||||||
|
@ -5,7 +5,7 @@ whether a *single* file path should be searched or not.
|
|||||||
In general, there are two ways to ignore a particular file:
|
In general, there are two ways to ignore a particular file:
|
||||||
|
|
||||||
1. Specify an ignore rule in some "global" configuration, such as a
|
1. Specify an ignore rule in some "global" configuration, such as a
|
||||||
$HOME/.xrepignore or on the command line.
|
$HOME/.rgignore or on the command line.
|
||||||
2. A specific ignore file (like .gitignore) found during directory traversal.
|
2. A specific ignore file (like .gitignore) found during directory traversal.
|
||||||
|
|
||||||
The `IgnoreDir` type handles ignore patterns for any one particular directory
|
The `IgnoreDir` type handles ignore patterns for any one particular directory
|
||||||
@ -24,7 +24,7 @@ use types::Types;
|
|||||||
const IGNORE_NAMES: &'static [&'static str] = &[
|
const IGNORE_NAMES: &'static [&'static str] = &[
|
||||||
".gitignore",
|
".gitignore",
|
||||||
".agignore",
|
".agignore",
|
||||||
".xrepignore",
|
".rgignore",
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Represents an error that can occur when parsing a gitignore file.
|
/// Represents an error that can occur when parsing a gitignore file.
|
||||||
@ -257,8 +257,8 @@ pub struct IgnoreDir {
|
|||||||
/// A single accumulation of glob patterns for this directory, matched
|
/// A single accumulation of glob patterns for this directory, matched
|
||||||
/// using gitignore semantics.
|
/// using gitignore semantics.
|
||||||
///
|
///
|
||||||
/// This will include patterns from xrepignore as well. The patterns are
|
/// This will include patterns from rgignore as well. The patterns are
|
||||||
/// ordered so that precedence applies automatically (e.g., xrepignore
|
/// ordered so that precedence applies automatically (e.g., rgignore
|
||||||
/// patterns procede gitignore patterns).
|
/// patterns procede gitignore patterns).
|
||||||
gi: Option<Gitignore>,
|
gi: Option<Gitignore>,
|
||||||
// TODO(burntsushi): Matching other types of glob patterns that don't
|
// TODO(burntsushi): Matching other types of glob patterns that don't
|
||||||
@ -422,7 +422,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const ROOT: &'static str = "/home/foobar/rust/xrep";
|
const ROOT: &'static str = "/home/foobar/rust/rg";
|
||||||
|
|
||||||
ignored_dir!(id1, ROOT, "src/main.rs", "", "src/main.rs");
|
ignored_dir!(id1, ROOT, "src/main.rs", "", "src/main.rs");
|
||||||
ignored_dir!(id2, ROOT, "", "src/main.rs", "src/main.rs");
|
ignored_dir!(id2, ROOT, "", "src/main.rs", "src/main.rs");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
This io module contains various platform specific functions for detecting
|
This io module contains various platform specific functions for detecting
|
||||||
how xrep is being used. e.g., Is stdin being piped into it? Is stdout being
|
how ripgrep is being used. e.g., Is stdin being piped into it? Is stdout being
|
||||||
redirected to a file? etc... We use this information to tweak various default
|
redirected to a file? etc... We use this information to tweak various default
|
||||||
configuration parameters such as colors and match formatting.
|
configuration parameters such as colors and match formatting.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user