printer: fix a few issues in the hyperlink docs

Closes #2612
This commit is contained in:
Lucas Trzesniewski 2023-09-26 00:38:25 +02:00 committed by Andrew Gallant
parent 3ad7a0d95e
commit c3e85f2b44
2 changed files with 8 additions and 8 deletions

View File

@ -1526,7 +1526,7 @@ fn flag_hyperlink_format(args: &mut Vec<RGArg>) {
Set the format of hyperlinks to match results. Hyperlinks make certain elements 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 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 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: The following variables are available in the format string:

View File

@ -48,7 +48,7 @@ impl HyperlinkConfig {
/// A hyperlink format with variables. /// 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 /// The default format is empty. An empty format is valid and effectively
/// disables hyperlinks. /// disables hyperlinks.
@ -181,7 +181,7 @@ impl std::fmt::Display for HyperlinkFormat {
/// A static environment for hyperlink interpolation. /// 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. /// interpolation that are not expected to change for the lifetime of a program.
/// That is, these values are invariant. /// That is, these values are invariant.
/// ///
@ -283,7 +283,7 @@ impl std::fmt::Display for HyperlinkFormatError {
write!( write!(
f, f,
"invalid hyperlink format variable: '{name}', choose \ "invalid hyperlink format variable: '{name}', choose \
from: path, line, column, host", from: path, line, column, host, wslprefix",
) )
} }
InvalidScheme => { 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)] #[derive(Debug)]
struct FormatBuilder { struct FormatBuilder {
parts: Vec<Part>, parts: Vec<Part>,
@ -385,7 +385,7 @@ impl FormatBuilder {
return Ok(()); return Ok(());
} }
// If all parts are just text, then there are no variables. It's // 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(_))) { if self.parts.iter().all(|p| matches!(*p, Part::Text(_))) {
return Err(err(NoVariables)); return Err(err(NoVariables));
} }
@ -651,7 +651,7 @@ impl HyperlinkPath {
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
// We canonicalize the path in order to get an absolute version of it // 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 // this does also remove symlinks, and in theory, it would be nice to
// retain them. Perhaps even simpler, we could just join the current // retain them. Perhaps even simpler, we could just join the current
// working directory with the path and be done with it. There was // working directory with the path and be done with it. There was