mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-23 21:54:45 +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:
@@ -53,7 +53,7 @@ fn generate_flag(flag: &'static dyn Flag, out: &mut String) {
|
||||
write!(out, r", ");
|
||||
}
|
||||
|
||||
let name = flag.name_long();
|
||||
let name = flag.name_long().replace("-", r"\-");
|
||||
write!(out, r"\fB\-\-{name}\fP");
|
||||
if let Some(var) = flag.doc_variable() {
|
||||
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() {
|
||||
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");
|
||||
});
|
||||
// Convert \flag-negate{foo} into something nicer.
|
||||
|
||||
Reference in New Issue
Block a user