mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-29 05:57:07 +02:00
man: escape all hyphens in flag names
Apparently, if we don't do this, some roff renderers with use a special Unicode hyphen. That in turn makes searching a man page not work as one would expect. Fixes #3140
This commit is contained in:
@@ -27,6 +27,8 @@ Bug fixes:
|
|||||||
Fix a bug where ripgrep would mishandle globs that ended with a `.`.
|
Fix a bug where ripgrep would mishandle globs that ended with a `.`.
|
||||||
* [BUG #3108](https://github.com/BurntSushi/ripgrep/issues/3108):
|
* [BUG #3108](https://github.com/BurntSushi/ripgrep/issues/3108):
|
||||||
Fix a bug where `-q --files-without-match` inverted the exit code.
|
Fix a bug where `-q --files-without-match` inverted the exit code.
|
||||||
|
* [BUG #3140](https://github.com/BurntSushi/ripgrep/issues/3140):
|
||||||
|
Ensure hyphens in flag names are escaped in the roff text for the man page.
|
||||||
|
|
||||||
Feature enhancements:
|
Feature enhancements:
|
||||||
|
|
||||||
|
|||||||
@@ -5576,9 +5576,9 @@ don't need preprocessing. For example, given the following shell script,
|
|||||||
pdftotext "$1" -
|
pdftotext "$1" -
|
||||||
.EE
|
.EE
|
||||||
.sp
|
.sp
|
||||||
then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP \fB--pre-glob
|
then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP
|
||||||
'\fP\fI*.pdf\fP\fB'\fP to make it so ripgrep only executes the
|
\fB\-\-pre\-glob\fP '\fI*.pdf\fP' to make it so ripgrep only executes
|
||||||
\fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension.
|
the \fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension.
|
||||||
.sp
|
.sp
|
||||||
Multiple \flag{pre-glob} flags may be used. Globbing rules match
|
Multiple \flag{pre-glob} flags may be used. Globbing rules match
|
||||||
\fBgitignore\fP globs. Precede a glob with a \fB!\fP to exclude it.
|
\fBgitignore\fP globs. Precede a glob with a \fB!\fP to exclude it.
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ fn generate_flag(flag: &'static dyn Flag, out: &mut String) {
|
|||||||
write!(out, r", ");
|
write!(out, r", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = flag.name_long();
|
let name = flag.name_long().replace("-", r"\-");
|
||||||
write!(out, r"\fB\-\-{name}\fP");
|
write!(out, r"\fB\-\-{name}\fP");
|
||||||
if let Some(var) = flag.doc_variable() {
|
if let Some(var) = flag.doc_variable() {
|
||||||
write!(out, r"=\fI{var}\fP");
|
write!(out, r"=\fI{var}\fP");
|
||||||
@@ -71,7 +71,7 @@ fn generate_flag(flag: &'static dyn Flag, out: &mut String) {
|
|||||||
if let Some(name) = flag.name_short() {
|
if let Some(name) = flag.name_short() {
|
||||||
write!(out, r"\-{}/", char::from(name));
|
write!(out, r"\-{}/", char::from(name));
|
||||||
}
|
}
|
||||||
write!(out, r"\-\-{}", flag.name_long());
|
write!(out, r"\-\-{}", flag.name_long().replace("-", r"\-"));
|
||||||
out.push_str(r"\fP");
|
out.push_str(r"\fP");
|
||||||
});
|
});
|
||||||
// Convert \flag-negate{foo} into something nicer.
|
// Convert \flag-negate{foo} into something nicer.
|
||||||
|
|||||||
Reference in New Issue
Block a user