From c3e85f2b44a05da44cea164adf14c3c39d769132 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Tue, 26 Sep 2023 00:38:25 +0200 Subject: [PATCH] printer: fix a few issues in the hyperlink docs Closes #2612 --- crates/core/app.rs | 2 +- crates/printer/src/hyperlink.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/core/app.rs b/crates/core/app.rs index d0dfc8d3..80dc2e47 100644 --- a/crates/core/app.rs +++ b/crates/core/app.rs @@ -1526,7 +1526,7 @@ fn flag_hyperlink_format(args: &mut Vec) { Set the format of hyperlinks to match results. Hyperlinks make certain elements of ripgrep's output, such as file paths, clickable. This generally only works in terminal emulators that support OSC-8 hyperlinks. For example, the format -*file://{host}{file}* will emit an RFC 8089 hyperlink. +*file://{host}{path}* will emit an RFC 8089 hyperlink. The following variables are available in the format string: diff --git a/crates/printer/src/hyperlink.rs b/crates/printer/src/hyperlink.rs index 7e6be6e4..d653d14e 100644 --- a/crates/printer/src/hyperlink.rs +++ b/crates/printer/src/hyperlink.rs @@ -48,7 +48,7 @@ impl HyperlinkConfig { /// A hyperlink format with variables. /// -/// This can be created by parsing a string using `HyperlinkPattern::from_str`. +/// This can be created by parsing a string using `HyperlinkFormat::from_str`. /// /// The default format is empty. An empty format is valid and effectively /// disables hyperlinks. @@ -181,7 +181,7 @@ impl std::fmt::Display for HyperlinkFormat { /// A static environment for hyperlink interpolation. /// -/// This environment permits setting the values of varibables used in hyperlink +/// This environment permits setting the values of variables used in hyperlink /// interpolation that are not expected to change for the lifetime of a program. /// That is, these values are invariant. /// @@ -283,7 +283,7 @@ impl std::fmt::Display for HyperlinkFormatError { write!( f, "invalid hyperlink format variable: '{name}', choose \ - from: path, line, column, host", + from: path, line, column, host, wslprefix", ) } InvalidScheme => { @@ -311,9 +311,9 @@ impl std::fmt::Display for HyperlinkFormatError { } } -/// A builder for `HyperlinkPattern`. +/// A builder for `HyperlinkFormat`. /// -/// Once a `HyperlinkPattern` is built, it is immutable. +/// Once a `HyperlinkFormat` is built, it is immutable. #[derive(Debug)] struct FormatBuilder { parts: Vec, @@ -385,7 +385,7 @@ impl FormatBuilder { return Ok(()); } // If all parts are just text, then there are no variables. It's - // likely a reference to invalid alias. + // likely a reference to an invalid alias. if self.parts.iter().all(|p| matches!(*p, Part::Text(_))) { return Err(err(NoVariables)); } @@ -651,7 +651,7 @@ impl HyperlinkPath { use std::os::unix::ffi::OsStrExt; // We canonicalize the path in order to get an absolute version of it - // without any `.` or `..` or superflous separators. Unfortunately, + // without any `.` or `..` or superfluous separators. Unfortunately, // this does also remove symlinks, and in theory, it would be nice to // retain them. Perhaps even simpler, we could just join the current // working directory with the path and be done with it. There was