1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-06-20 06:15:37 +02:00

printer: move PathPrinter into grep-printer

I originally did not put PathPrinter into grep-printer because I
considered it somewhat extraneous to what a "grep" program does, and
also that its implementation was rather simple. But now with hyperlink
support, its implementation has grown a smidge more complicated. And
more importantly, its existence required exposing a lot more of the
hyperlink guts. Without it, we can keep things like HyperlinkPath and
HyperlinkSpan completely private.

We can now also keep `PrinterPath` completely private as well. And this
is a breaking change.
This commit is contained in:
Andrew Gallant
2023-09-21 17:28:58 -04:00
parent 09905560ff
commit 23e21133ba
9 changed files with 222 additions and 159 deletions

View File

@ -218,7 +218,15 @@ impl SummaryBuilder {
/// Set the hyperlink pattern to use for hyperlinks output by this printer.
///
/// Colors need to be enabled for hyperlinks to be output.
/// Regardless of the hyperlink format provided here, whether hyperlinks
/// are actually used or not is determined by the implementation of
/// `WriteColor` provided to `build`. For example, if `termcolor::NoColor`
/// is provided to `build`, then no hyperlinks will ever be printed
/// regardless of the format provided here.
///
/// This completely overrides any previous hyperlink format.
///
/// The default pattern format results in not emitting any hyperlinks.
pub fn hyperlink_pattern(
&mut self,
pattern: HyperlinkPattern,