2016-02-27 18:07:26 +02:00
|
|
|
[package]
|
2016-09-08 22:15:44 +02:00
|
|
|
name = "ripgrep"
|
2024-01-06 21:32:27 +02:00
|
|
|
version = "14.1.0" #:version
|
2016-02-27 18:07:26 +02:00
|
|
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
|
|
|
description = """
|
2021-05-30 09:03:40 +02:00
|
|
|
ripgrep is a line-oriented search tool that recursively searches the current
|
|
|
|
directory for a regex pattern while respecting gitignore rules. ripgrep has
|
|
|
|
first class support on Windows, macOS and Linux.
|
2016-02-27 18:07:26 +02:00
|
|
|
"""
|
2016-09-08 22:15:44 +02:00
|
|
|
documentation = "https://github.com/BurntSushi/ripgrep"
|
|
|
|
homepage = "https://github.com/BurntSushi/ripgrep"
|
|
|
|
repository = "https://github.com/BurntSushi/ripgrep"
|
2016-02-27 18:07:26 +02:00
|
|
|
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
2017-01-21 18:31:09 +02:00
|
|
|
categories = ["command-line-utilities", "text-processing"]
|
2018-07-21 19:25:39 +02:00
|
|
|
license = "Unlicense OR MIT"
|
2021-07-20 01:32:59 +02:00
|
|
|
exclude = [
|
|
|
|
"HomebrewFormula",
|
|
|
|
"/.github/",
|
|
|
|
"/ci/",
|
2023-11-26 23:31:42 +02:00
|
|
|
"/pkg/brew",
|
2021-07-20 01:32:59 +02:00
|
|
|
"/benchsuite/",
|
|
|
|
"/scripts/",
|
|
|
|
]
|
Switch from Docopt to Clap.
There were two important reasons for the switch:
1. Performance. Docopt does poorly when the argv becomes large, which is
a reasonable common use case for search tools. (e.g., use with xargs)
2. Better failure modes. Clap knows a lot more about how a particular
argv might be invalid, and can therefore provide much clearer error
messages.
While both were important, (1) made it urgent.
Note that since Clap requires at least Rust 1.11, this will in turn
increase the minimum Rust version supported by ripgrep from Rust 1.9 to
Rust 1.11. It is therefore a breaking change, so the soonest release of
ripgrep with Clap will have to be 0.3.
There is also at least one subtle breaking change in real usage.
Previous to this commit, this used to work:
rg -e -foo
Where this would cause ripgrep to search for the string `-foo`. Clap
currently has problems supporting this use case
(see: https://github.com/kbknapp/clap-rs/issues/742),
but it can be worked around by using this instead:
rg -e [-]foo
or even
rg [-]foo
and this still works:
rg -- -foo
This commit also adds Bash, Fish and PowerShell completion files to the
release, fixes a bug that prevented ripgrep from working on file
paths containing invalid UTF-8 and shows short descriptions in the
output of `-h` but longer descriptions in the output of `--help`.
Fixes #136, Fixes #189, Fixes #210, Fixes #230
2016-11-13 04:48:11 +02:00
|
|
|
build = "build.rs"
|
2018-06-24 02:19:34 +02:00
|
|
|
autotests = false
|
2023-09-28 22:24:40 +02:00
|
|
|
edition = "2021"
|
|
|
|
rust-version = "1.72"
|
2016-02-27 18:07:26 +02:00
|
|
|
|
2016-08-26 03:44:37 +02:00
|
|
|
[[bin]]
|
|
|
|
bench = false
|
2020-02-18 01:28:09 +02:00
|
|
|
path = "crates/core/main.rs"
|
2016-09-08 22:15:44 +02:00
|
|
|
name = "rg"
|
2016-08-26 03:44:37 +02:00
|
|
|
|
2016-09-10 04:58:30 +02:00
|
|
|
[[test]]
|
|
|
|
name = "integration"
|
|
|
|
path = "tests/tests.rs"
|
|
|
|
|
2017-12-19 01:04:49 +02:00
|
|
|
[workspace]
|
2018-04-29 15:29:52 +02:00
|
|
|
members = [
|
2020-02-18 01:28:09 +02:00
|
|
|
"crates/globset",
|
|
|
|
"crates/grep",
|
|
|
|
"crates/cli",
|
|
|
|
"crates/matcher",
|
|
|
|
"crates/pcre2",
|
|
|
|
"crates/printer",
|
|
|
|
"crates/regex",
|
|
|
|
"crates/searcher",
|
|
|
|
"crates/ignore",
|
2018-04-29 15:29:52 +02:00
|
|
|
]
|
2017-12-19 01:04:49 +02:00
|
|
|
|
2016-02-27 18:07:26 +02:00
|
|
|
[dependencies]
|
2023-10-12 18:16:42 +02:00
|
|
|
anyhow = "1.0.75"
|
cli: replace clap with lexopt and supporting code
ripgrep began it's life with docopt for argument parsing. Then it moved
to Clap and stayed there for a number of years. Clap has served ripgrep
well, and it probably could continue to serve ripgrep well, but I ended
up deciding to move off of it.
Why?
The first time I had the thought of moving off of Clap was during the
2->3->4 transition. I thought the 3.x and 4.x releases were great, but
for me, it ended up moving a little too quickly. Since the release of
4.x was telegraphed around when 3.x came out, I decided to just hold off
and wait to migrate to 4.x instead of doing a 3.x migration followed
shortly by another 4.x migration. Of course, I just never ended up doing
the migration at all. I never got around to it and there just wasn't a
compelling reason for me to upgrade. While I never investigated it, I
saw an upgrade as a non-trivial amount of work in part because I didn't
encapsulate the usage of Clap enough.
The above is just what got me started thinking about it. It wasn't
enough to get me to move off of it on its own. What ended up pushing me
over the edge was a combination of factors:
* As mentioned above, I didn't want to run on the migration treadmill.
This has proven to not be much of an issue, but at the time of the
2->3->4 releases, I didn't know how long Clap 4.x would be out before a
5.x would come out.
* The release of lexopt[1] caught my eye. IMO, that crate demonstrates
exactly how something new can arrive on the scene and just thoroughly
solve a problem minimalistically. It has the docs, the reasoning, the
simple API, the tests and good judgment. It gets all the weird corner
cases right that Clap also gets right (and is part of why I was
originally attracted to Clap).
* I have an overall desire to reduce the size of my dependency tree. In
part because a smaller dependency tree tends to correlate with better
compile times, but also in part because it reduces my reliance and trust
on others. It lets me be the "master" of ripgrep's destiny by reducing
the amount of behavior that is the result of someone else's decision
(whether good or bad).
* I perceived that Clap solves a more general problem than what I
actually need solved. Despite the vast number of flags that ripgrep has,
its requirements are actually pretty simple. We just need simple
switches and flags that support one value. No multi-value flags. No
sub-commands. And probably a lot of other functionality that Clap has
that makes it so flexible for so many different use cases. (I'm being
hand wavy on the last point.)
With all that said, perhaps most importantly, the future of ripgrep
possibly demands a more flexible CLI argument parser. In today's world,
I would really like, for example, flags like `--type` and `--type-not`
to be able to accumulate their repeated values into a single sequence
while respecting the order they appear on the CLI. For example, prior
to this migration, `rg regex-automata -Tlock -ttoml` would not return
results in `Cargo.lock` in this repository because the `-Tlock` always
took priority even though `-ttoml` appeared after it. But with this
migration, `-ttoml` now correctly overrides `-Tlock`. We would like to
do similar things for `-g/--glob` and `--iglob` and potentially even
now introduce a `-G/--glob-not` flag instead of requiring users to use
`!` to negate a glob. (Which I had done originally to work-around this
problem.) And some day, I'd like to add some kind of boolean matching to
ripgrep perhaps similar to how `git grep` does it. (Although I haven't
thought too carefully on a design yet.) In order to do that, I perceive
it would be difficult to implement correctly in Clap.
I believe that this last point is possible to implement correctly in
Clap 2.x, although it is awkward to do so. I have not looked closely
enough at the Clap 4.x API to know whether it's still possible there. In
any case, these were enough reasons to move off of Clap and own more of
the argument parsing process myself.
This did require a few things:
* I had to write my own logic for how arguments are combined into one
single state object. Of course, I wanted this. This was part of the
upside. But it's still code I didn't have to write for Clap.
* I had to write my own shell completion generator.
* I had to write my own `-h/--help` output generator.
* I also had to write my own man page generator. Well, I had to do this
with Clap 2.x too, although my understanding is that Clap 4.x supports
this. With that said, without having tried it, my guess is that I
probably wouldn't have liked the output it generated because I
ultimately had to write most of the roff by hand myself to get the man
page I wanted. (This also had the benefit of dropping the build
dependency on asciidoc/asciidoctor.)
While this is definitely a fair bit of extra work, it overall only cost
me a couple days. IMO, that's a good trade off given that this code is
unlikely to change again in any substantial way. And it should also
allow for more flexible semantics going forward.
Fixes #884, Fixes #1648, Fixes #1701, Fixes #1814, Fixes #1966
[1]: https://docs.rs/lexopt/0.3.0/lexopt/index.html
2023-10-17 00:05:39 +02:00
|
|
|
bstr = "1.7.0"
|
2023-11-28 04:37:41 +02:00
|
|
|
grep = { version = "0.3.1", path = "crates/grep" }
|
2024-01-06 21:28:28 +02:00
|
|
|
ignore = { version = "0.4.22", path = "crates/ignore" }
|
cli: replace clap with lexopt and supporting code
ripgrep began it's life with docopt for argument parsing. Then it moved
to Clap and stayed there for a number of years. Clap has served ripgrep
well, and it probably could continue to serve ripgrep well, but I ended
up deciding to move off of it.
Why?
The first time I had the thought of moving off of Clap was during the
2->3->4 transition. I thought the 3.x and 4.x releases were great, but
for me, it ended up moving a little too quickly. Since the release of
4.x was telegraphed around when 3.x came out, I decided to just hold off
and wait to migrate to 4.x instead of doing a 3.x migration followed
shortly by another 4.x migration. Of course, I just never ended up doing
the migration at all. I never got around to it and there just wasn't a
compelling reason for me to upgrade. While I never investigated it, I
saw an upgrade as a non-trivial amount of work in part because I didn't
encapsulate the usage of Clap enough.
The above is just what got me started thinking about it. It wasn't
enough to get me to move off of it on its own. What ended up pushing me
over the edge was a combination of factors:
* As mentioned above, I didn't want to run on the migration treadmill.
This has proven to not be much of an issue, but at the time of the
2->3->4 releases, I didn't know how long Clap 4.x would be out before a
5.x would come out.
* The release of lexopt[1] caught my eye. IMO, that crate demonstrates
exactly how something new can arrive on the scene and just thoroughly
solve a problem minimalistically. It has the docs, the reasoning, the
simple API, the tests and good judgment. It gets all the weird corner
cases right that Clap also gets right (and is part of why I was
originally attracted to Clap).
* I have an overall desire to reduce the size of my dependency tree. In
part because a smaller dependency tree tends to correlate with better
compile times, but also in part because it reduces my reliance and trust
on others. It lets me be the "master" of ripgrep's destiny by reducing
the amount of behavior that is the result of someone else's decision
(whether good or bad).
* I perceived that Clap solves a more general problem than what I
actually need solved. Despite the vast number of flags that ripgrep has,
its requirements are actually pretty simple. We just need simple
switches and flags that support one value. No multi-value flags. No
sub-commands. And probably a lot of other functionality that Clap has
that makes it so flexible for so many different use cases. (I'm being
hand wavy on the last point.)
With all that said, perhaps most importantly, the future of ripgrep
possibly demands a more flexible CLI argument parser. In today's world,
I would really like, for example, flags like `--type` and `--type-not`
to be able to accumulate their repeated values into a single sequence
while respecting the order they appear on the CLI. For example, prior
to this migration, `rg regex-automata -Tlock -ttoml` would not return
results in `Cargo.lock` in this repository because the `-Tlock` always
took priority even though `-ttoml` appeared after it. But with this
migration, `-ttoml` now correctly overrides `-Tlock`. We would like to
do similar things for `-g/--glob` and `--iglob` and potentially even
now introduce a `-G/--glob-not` flag instead of requiring users to use
`!` to negate a glob. (Which I had done originally to work-around this
problem.) And some day, I'd like to add some kind of boolean matching to
ripgrep perhaps similar to how `git grep` does it. (Although I haven't
thought too carefully on a design yet.) In order to do that, I perceive
it would be difficult to implement correctly in Clap.
I believe that this last point is possible to implement correctly in
Clap 2.x, although it is awkward to do so. I have not looked closely
enough at the Clap 4.x API to know whether it's still possible there. In
any case, these were enough reasons to move off of Clap and own more of
the argument parsing process myself.
This did require a few things:
* I had to write my own logic for how arguments are combined into one
single state object. Of course, I wanted this. This was part of the
upside. But it's still code I didn't have to write for Clap.
* I had to write my own shell completion generator.
* I had to write my own `-h/--help` output generator.
* I also had to write my own man page generator. Well, I had to do this
with Clap 2.x too, although my understanding is that Clap 4.x supports
this. With that said, without having tried it, my guess is that I
probably wouldn't have liked the output it generated because I
ultimately had to write most of the roff by hand myself to get the man
page I wanted. (This also had the benefit of dropping the build
dependency on asciidoc/asciidoctor.)
While this is definitely a fair bit of extra work, it overall only cost
me a couple days. IMO, that's a good trade off given that this code is
unlikely to change again in any substantial way. And it should also
allow for more flexible semantics going forward.
Fixes #884, Fixes #1648, Fixes #1701, Fixes #1814, Fixes #1966
[1]: https://docs.rs/lexopt/0.3.0/lexopt/index.html
2023-10-17 00:05:39 +02:00
|
|
|
lexopt = "0.3.0"
|
2018-09-07 19:14:31 +02:00
|
|
|
log = "0.4.5"
|
|
|
|
serde_json = "1.0.23"
|
2020-03-16 03:38:59 +02:00
|
|
|
termcolor = "1.1.0"
|
cli: replace clap with lexopt and supporting code
ripgrep began it's life with docopt for argument parsing. Then it moved
to Clap and stayed there for a number of years. Clap has served ripgrep
well, and it probably could continue to serve ripgrep well, but I ended
up deciding to move off of it.
Why?
The first time I had the thought of moving off of Clap was during the
2->3->4 transition. I thought the 3.x and 4.x releases were great, but
for me, it ended up moving a little too quickly. Since the release of
4.x was telegraphed around when 3.x came out, I decided to just hold off
and wait to migrate to 4.x instead of doing a 3.x migration followed
shortly by another 4.x migration. Of course, I just never ended up doing
the migration at all. I never got around to it and there just wasn't a
compelling reason for me to upgrade. While I never investigated it, I
saw an upgrade as a non-trivial amount of work in part because I didn't
encapsulate the usage of Clap enough.
The above is just what got me started thinking about it. It wasn't
enough to get me to move off of it on its own. What ended up pushing me
over the edge was a combination of factors:
* As mentioned above, I didn't want to run on the migration treadmill.
This has proven to not be much of an issue, but at the time of the
2->3->4 releases, I didn't know how long Clap 4.x would be out before a
5.x would come out.
* The release of lexopt[1] caught my eye. IMO, that crate demonstrates
exactly how something new can arrive on the scene and just thoroughly
solve a problem minimalistically. It has the docs, the reasoning, the
simple API, the tests and good judgment. It gets all the weird corner
cases right that Clap also gets right (and is part of why I was
originally attracted to Clap).
* I have an overall desire to reduce the size of my dependency tree. In
part because a smaller dependency tree tends to correlate with better
compile times, but also in part because it reduces my reliance and trust
on others. It lets me be the "master" of ripgrep's destiny by reducing
the amount of behavior that is the result of someone else's decision
(whether good or bad).
* I perceived that Clap solves a more general problem than what I
actually need solved. Despite the vast number of flags that ripgrep has,
its requirements are actually pretty simple. We just need simple
switches and flags that support one value. No multi-value flags. No
sub-commands. And probably a lot of other functionality that Clap has
that makes it so flexible for so many different use cases. (I'm being
hand wavy on the last point.)
With all that said, perhaps most importantly, the future of ripgrep
possibly demands a more flexible CLI argument parser. In today's world,
I would really like, for example, flags like `--type` and `--type-not`
to be able to accumulate their repeated values into a single sequence
while respecting the order they appear on the CLI. For example, prior
to this migration, `rg regex-automata -Tlock -ttoml` would not return
results in `Cargo.lock` in this repository because the `-Tlock` always
took priority even though `-ttoml` appeared after it. But with this
migration, `-ttoml` now correctly overrides `-Tlock`. We would like to
do similar things for `-g/--glob` and `--iglob` and potentially even
now introduce a `-G/--glob-not` flag instead of requiring users to use
`!` to negate a glob. (Which I had done originally to work-around this
problem.) And some day, I'd like to add some kind of boolean matching to
ripgrep perhaps similar to how `git grep` does it. (Although I haven't
thought too carefully on a design yet.) In order to do that, I perceive
it would be difficult to implement correctly in Clap.
I believe that this last point is possible to implement correctly in
Clap 2.x, although it is awkward to do so. I have not looked closely
enough at the Clap 4.x API to know whether it's still possible there. In
any case, these were enough reasons to move off of Clap and own more of
the argument parsing process myself.
This did require a few things:
* I had to write my own logic for how arguments are combined into one
single state object. Of course, I wanted this. This was part of the
upside. But it's still code I didn't have to write for Clap.
* I had to write my own shell completion generator.
* I had to write my own `-h/--help` output generator.
* I also had to write my own man page generator. Well, I had to do this
with Clap 2.x too, although my understanding is that Clap 4.x supports
this. With that said, without having tried it, my guess is that I
probably wouldn't have liked the output it generated because I
ultimately had to write most of the roff by hand myself to get the man
page I wanted. (This also had the benefit of dropping the build
dependency on asciidoc/asciidoctor.)
While this is definitely a fair bit of extra work, it overall only cost
me a couple days. IMO, that's a good trade off given that this code is
unlikely to change again in any substantial way. And it should also
allow for more flexible semantics going forward.
Fixes #884, Fixes #1648, Fixes #1701, Fixes #1814, Fixes #1966
[1]: https://docs.rs/lexopt/0.3.0/lexopt/index.html
2023-10-17 00:05:39 +02:00
|
|
|
textwrap = { version = "0.16.0", default-features = false }
|
2018-02-04 04:50:30 +02:00
|
|
|
|
2019-04-25 16:49:59 +02:00
|
|
|
[target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.jemallocator]
|
2023-01-05 15:33:43 +02:00
|
|
|
version = "0.5.0"
|
2019-04-24 23:21:38 +02:00
|
|
|
|
2018-08-07 02:11:58 +02:00
|
|
|
[dev-dependencies]
|
2018-09-07 19:14:31 +02:00
|
|
|
serde = "1.0.77"
|
|
|
|
serde_derive = "1.0.77"
|
2020-02-19 14:28:08 +02:00
|
|
|
walkdir = "2"
|
2018-08-07 02:11:58 +02:00
|
|
|
|
2016-08-27 07:01:06 +02:00
|
|
|
[features]
|
2018-08-03 23:26:22 +02:00
|
|
|
pcre2 = ["grep/pcre2"]
|
2016-08-27 07:01:06 +02:00
|
|
|
|
2016-02-27 18:07:26 +02:00
|
|
|
[profile.release]
|
2018-08-03 23:26:22 +02:00
|
|
|
debug = 1
|
2018-08-22 03:26:18 +02:00
|
|
|
|
2023-11-28 04:31:03 +02:00
|
|
|
[profile.release-lto]
|
|
|
|
inherits = "release"
|
|
|
|
opt-level = 3
|
|
|
|
debug = "none"
|
|
|
|
strip = "symbols"
|
|
|
|
debug-assertions = false
|
|
|
|
overflow-checks = false
|
|
|
|
lto = "fat"
|
|
|
|
panic = "abort"
|
|
|
|
incremental = false
|
|
|
|
codegen-units = 1
|
|
|
|
|
2023-11-26 00:33:16 +02:00
|
|
|
# This is the main way to strip binaries in the deb package created by
|
|
|
|
# 'cargo deb'. For other release binaries, we (currently) call 'strip'
|
|
|
|
# explicitly in the release process.
|
|
|
|
[profile.deb]
|
|
|
|
inherits = "release"
|
|
|
|
debug = false
|
|
|
|
|
2018-08-22 03:26:18 +02:00
|
|
|
[package.metadata.deb]
|
|
|
|
features = ["pcre2"]
|
2018-09-13 14:17:24 +02:00
|
|
|
section = "utils"
|
2018-08-22 03:26:18 +02:00
|
|
|
assets = [
|
|
|
|
["target/release/rg", "usr/bin/", "755"],
|
|
|
|
["COPYING", "usr/share/doc/ripgrep/", "644"],
|
|
|
|
["LICENSE-MIT", "usr/share/doc/ripgrep/", "644"],
|
|
|
|
["UNLICENSE", "usr/share/doc/ripgrep/", "644"],
|
|
|
|
["CHANGELOG.md", "usr/share/doc/ripgrep/CHANGELOG", "644"],
|
|
|
|
["README.md", "usr/share/doc/ripgrep/README", "644"],
|
|
|
|
["FAQ.md", "usr/share/doc/ripgrep/FAQ", "644"],
|
|
|
|
# The man page is automatically generated by ripgrep's build process, so
|
2020-09-22 16:29:16 +02:00
|
|
|
# this file isn't actually committed. Instead, to create a dpkg, either
|
2018-09-07 19:28:57 +02:00
|
|
|
# create a deployment/deb directory and copy the man page to it, or use the
|
2020-03-16 02:43:13 +02:00
|
|
|
# 'ci/build-deb' script.
|
2018-09-07 19:28:57 +02:00
|
|
|
["deployment/deb/rg.1", "usr/share/man/man1/rg.1", "644"],
|
|
|
|
# Similarly for shell completions.
|
|
|
|
["deployment/deb/rg.bash", "usr/share/bash-completion/completions/rg", "644"],
|
2020-02-17 20:33:35 +02:00
|
|
|
["deployment/deb/rg.fish", "usr/share/fish/vendor_completions.d/rg.fish", "644"],
|
2018-09-07 19:28:57 +02:00
|
|
|
["deployment/deb/_rg", "usr/share/zsh/vendor-completions/", "644"],
|
2018-08-22 03:26:18 +02:00
|
|
|
]
|
|
|
|
extended-description = """\
|
|
|
|
ripgrep (rg) recursively searches your current directory for a regex pattern.
|
|
|
|
By default, ripgrep will respect your .gitignore and automatically skip hidden
|
|
|
|
files/directories and binary files.
|
|
|
|
"""
|