mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-17 21:23:48 -07:00
Compare commits
9 Commits
14.1.1
...
globset-0.
Author | SHA1 | Date | |
---|---|---|---|
|
de4baa1002 | ||
|
163ac157d3 | ||
|
e2362d4d51 | ||
|
d6b59feff8 | ||
|
94305125ef | ||
|
79cbe89deb | ||
|
bf63fe8f25 | ||
|
8bd5950296 | ||
|
6e0539ab91 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -189,7 +189,7 @@ jobs:
|
||||
shell: bash
|
||||
run: ${{ env.CARGO }} test --bin rg ${{ env.TARGET_FLAGS }} flags::defs::tests::available_shorts -- --nocapture
|
||||
|
||||
# Setup and compile on the wasm32-wasi target
|
||||
# Setup and compile on the wasm32-wasip1 target
|
||||
wasm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -199,8 +199,8 @@ jobs:
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
- name: Add wasm32-wasi target
|
||||
run: rustup target add wasm32-wasi
|
||||
- name: Add wasm32-wasip1 target
|
||||
run: rustup target add wasm32-wasip1
|
||||
- name: Basic build
|
||||
run: cargo build --verbose
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
TBD
|
||||
===
|
||||
Unreleased changes. Release notes have not yet been written.
|
||||
|
||||
|
||||
14.1.1 (2024-09-08)
|
||||
===================
|
||||
This is a minor release with a bug fix for a matching bug. In particular, a bug
|
||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -105,7 +105,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.15"
|
||||
version = "0.4.16"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
|
23
FAQ.md
23
FAQ.md
@@ -94,7 +94,7 @@ Does ripgrep have support for shell auto-completion?
|
||||
|
||||
Yes! If you installed ripgrep through a package manager on a Unix system, then
|
||||
the shell completion files included in the release archive should have been
|
||||
installed for you automatically. If not, you can generate completes using
|
||||
installed for you automatically. If not, you can generate completions using
|
||||
ripgrep's command line interface.
|
||||
|
||||
For **bash**:
|
||||
@@ -113,14 +113,31 @@ $ mkdir -p "$dir"
|
||||
$ rg --generate complete-fish > "$dir/rg.fish"
|
||||
```
|
||||
|
||||
For **zsh**:
|
||||
For **zsh**, the recommended approach is:
|
||||
|
||||
```
|
||||
```zsh
|
||||
$ dir="$HOME/.zsh-complete"
|
||||
$ mkdir -p "$dir"
|
||||
$ rg --generate complete-zsh > "$dir/_rg"
|
||||
```
|
||||
|
||||
And then add `$HOME/.zsh-complete` to your `fpath` in, e.g., your
|
||||
`$HOME/.zshrc` file:
|
||||
|
||||
```zsh
|
||||
fpath=($HOME/.zsh-complete $fpath)
|
||||
```
|
||||
|
||||
Or if you'd prefer to load and generate completions at the same time, you can
|
||||
add the following to your `$HOME/.zshrc` file:
|
||||
|
||||
```zsh
|
||||
$ source <(rg --generate complete-zsh)
|
||||
```
|
||||
|
||||
Note though that while this approach is easier to setup, is generally slower
|
||||
than the previous method, and will add more time to loading your shell prompt.
|
||||
|
||||
For **PowerShell**, create the completions:
|
||||
|
||||
```
|
||||
|
@@ -434,7 +434,15 @@ _rg_types() {
|
||||
fi
|
||||
}
|
||||
|
||||
_rg "$@"
|
||||
# Don't run the completion function when being sourced by itself.
|
||||
#
|
||||
# See https://github.com/BurntSushi/ripgrep/issues/2956
|
||||
# See https://github.com/BurntSushi/ripgrep/pull/2957
|
||||
if [[ $funcstack[1] == _rg ]] || (( ! $+functions[compdef] )); then
|
||||
_rg "$@"
|
||||
else
|
||||
compdef _rg rg
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# ZSH COMPLETION REFERENCE
|
||||
|
@@ -43,10 +43,10 @@ configuration file. The file can specify one shell argument per line. Lines
|
||||
starting with \fB#\fP are ignored. For more details, see \fBCONFIGURATION
|
||||
FILES\fP below.
|
||||
.sp
|
||||
ripgrep will automatically detect if stdin exists and search stdin for a regex
|
||||
pattern, e.g. \fBls | rg foo\fP. In some environments, stdin may exist when
|
||||
it shouldn't. To turn off stdin detection, one can explicitly specify the
|
||||
directory to search, e.g. \fBrg foo ./\fP.
|
||||
ripgrep will automatically detect if stdin is a readable file and search stdin
|
||||
for a regex pattern, e.g. \fBls | rg foo\fP. In some environments, stdin may
|
||||
exist when it shouldn't. To turn off stdin detection, one can explicitly
|
||||
specify the directory to search, e.g. \fBrg foo ./\fP.
|
||||
.sp
|
||||
Like other tools such as \fBls\fP, ripgrep will alter its output depending on
|
||||
whether stdout is connected to a tty. By default, when printing a tty, ripgrep
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "globset"
|
||||
version = "0.4.15" #:version
|
||||
version = "0.4.16" #:version
|
||||
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
||||
description = """
|
||||
Cross platform single glob and glob set matching. Glob set matching is the
|
||||
|
@@ -928,13 +928,26 @@ impl RequiredExtensionStrategyBuilder {
|
||||
///
|
||||
/// The escaping works by surrounding meta-characters with brackets. For
|
||||
/// example, `*` becomes `[*]`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use globset::escape;
|
||||
///
|
||||
/// assert_eq!(escape("foo*bar"), "foo[*]bar");
|
||||
/// assert_eq!(escape("foo?bar"), "foo[?]bar");
|
||||
/// assert_eq!(escape("foo[bar"), "foo[[]bar");
|
||||
/// assert_eq!(escape("foo]bar"), "foo[]]bar");
|
||||
/// assert_eq!(escape("foo{bar"), "foo[{]bar");
|
||||
/// assert_eq!(escape("foo}bar"), "foo[}]bar");
|
||||
/// ```
|
||||
pub fn escape(s: &str) -> String {
|
||||
let mut escaped = String::with_capacity(s.len());
|
||||
for c in s.chars() {
|
||||
match c {
|
||||
// note that ! does not need escaping because it is only special
|
||||
// inside brackets
|
||||
'?' | '*' | '[' | ']' => {
|
||||
'?' | '*' | '[' | ']' | '{' | '}' => {
|
||||
escaped.push('[');
|
||||
escaped.push(c);
|
||||
escaped.push(']');
|
||||
|
@@ -389,6 +389,15 @@ pub trait Captures {
|
||||
/// for the overall match.
|
||||
fn get(&self, i: usize) -> Option<Match>;
|
||||
|
||||
/// Return the overall match for the capture.
|
||||
///
|
||||
/// This returns the match for index `0`. That is it is equivalent to
|
||||
/// `get(0).unwrap()`
|
||||
#[inline]
|
||||
fn as_match(&self) -> Match {
|
||||
self.get(0).unwrap()
|
||||
}
|
||||
|
||||
/// Returns true if and only if these captures are empty. This occurs
|
||||
/// when `len` is `0`.
|
||||
///
|
||||
|
@@ -1004,6 +1004,7 @@ fn slice_has_bom(slice: &[u8]) -> bool {
|
||||
None => return false,
|
||||
Some((enc, _)) => enc,
|
||||
};
|
||||
log::trace!("found byte-order mark (BOM) for encoding {enc:?}");
|
||||
[encoding_rs::UTF_16LE, encoding_rs::UTF_16BE, encoding_rs::UTF_8]
|
||||
.contains(&enc)
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
class RipgrepBin < Formula
|
||||
version '14.1.0'
|
||||
version '14.1.1'
|
||||
desc "Recursively search directories for a regex pattern."
|
||||
homepage "https://github.com/BurntSushi/ripgrep"
|
||||
|
||||
if OS.mac?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
sha256 "fc87e78f7cb3fea12d69072e7ef3b21509754717b746368fd40d88963630e2b3"
|
||||
elsif OS.linux?
|
||||
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
|
||||
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
sha256 "4cf9f2741e6c465ffdb7c26f38056a59e2a2544b51f7cc128ef28337eeae4d8e"
|
||||
end
|
||||
|
||||
conflicts_with "ripgrep"
|
||||
|
Reference in New Issue
Block a user