mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2024-12-12 19:18:24 +02:00
f608d4d9b3
This essentially takes the work done in #2483 and does a bit of a facelift. A brief summary: * We reduce the hyperlink API we expose to just the format, a configuration and an environment. * We move buffer management into a hyperlink-specific interpolator. * We expand the documentation on --hyperlink-format. * We rewrite the hyperlink format parser to be a simple state machine with support for escaping '{{' and '}}'. * We remove the 'gethostname' dependency and instead insist on the caller to provide the hostname. (So grep-printer doesn't get it itself, but the application will.) Similarly for the WSL prefix. * Probably some other things. Overall, the general structure of #2483 was kept. The biggest change is probably requiring the caller to pass in things like a hostname instead of having the crate do it. I did this for a couple reasons: 1. I feel uncomfortable with code deep inside the printing logic reaching out into the environment to assume responsibility for retrieving the hostname. This feels more like an application-level responsibility. Arguably, path canonicalization falls into this same bucket, but it is more difficult to rip that out. (And we can do it in the future in a backwards compatible fashion I think.) 2. I wanted to permit end users to tell ripgrep about their system's hostname in their own way, e.g., by running a custom executable. I want this because I know at least for my own use cases, I sometimes log into systems using an SSH hostname that is distinct from the system's actual hostname (usually because the system is shared in some way or changing its hostname is not allowed/practical). I think that's about it. Closes #665, Closes #2483
45 lines
1.5 KiB
TOML
45 lines
1.5 KiB
TOML
[package]
|
|
name = "grep-printer"
|
|
version = "0.1.7" #:version
|
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
|
description = """
|
|
An implementation of the grep crate's Sink trait that provides standard
|
|
printing of search results, similar to grep itself.
|
|
"""
|
|
documentation = "https://docs.rs/grep-printer"
|
|
homepage = "https://github.com/BurntSushi/ripgrep/tree/master/crates/printer"
|
|
repository = "https://github.com/BurntSushi/ripgrep/tree/master/crates/printer"
|
|
readme = "README.md"
|
|
keywords = ["grep", "pattern", "print", "printer", "sink"]
|
|
license = "Unlicense OR MIT"
|
|
edition = "2021"
|
|
|
|
[features]
|
|
default = ["serde"]
|
|
serde = ["dep:base64", "dep:serde", "dep:serde_json"]
|
|
|
|
[dependencies]
|
|
base64 = { version = "0.21.4", optional = true }
|
|
bstr = "1.6.2"
|
|
grep-matcher = { version = "0.1.6", path = "../matcher" }
|
|
grep-searcher = { version = "0.1.11", path = "../searcher" }
|
|
log = "0.4.5"
|
|
termcolor = "1.3.0"
|
|
serde = { version = "1.0.188", optional = true, features = ["derive"] }
|
|
serde_json = { version = "1.0.107", optional = true }
|
|
|
|
[dev-dependencies]
|
|
grep-regex = { version = "0.1.11", path = "../regex" }
|
|
|
|
[package.metadata.docs.rs]
|
|
# We want to document all features.
|
|
all-features = true
|
|
# This opts into a nightly unstable option to show the features that need to be
|
|
# enabled for public API items. To do that, we set 'docsrs', and when that's
|
|
# enabled, we enable the 'doc_auto_cfg' feature.
|
|
#
|
|
# To test this locally, run:
|
|
#
|
|
# RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
|
|
rustdoc-args = ["--cfg", "docsrs"]
|