Skip to content
Myr

man: escape all hyphens in flag names

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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

authored by Andrew Gallant · committed by Andrew Gallant · parent 78383de · Browse files · 3 files+7 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+7 added−5 removed

  • other:+7 added−5 removed

3 files+7 added−5 removed

modified:crates/core/flags/doc/man.rs+2 added-2 removed
51 unmodified lines
52 }53 write!(out, r", ");54 }5556 let name = flag.name_long();56 let name = flag.name_long().replace("-", r"\-");57 write!(out, r"\fB\-\-{name}\fP");58 if let Some(var) = flag.doc_variable() {59 write!(out, r"=\fI{var}\fP");60 }
9 unmodified lines
70 out.push_str(r"\fB");71 if let Some(name) = flag.name_short() {72 write!(out, r"\-{}/", char::from(name));73 }74 write!(out, r"\-\-{}", flag.name_long());74 write!(out, r"\-\-{}", flag.name_long().replace("-", r"\-"));75 out.push_str(r"\fP");76 });77 // Convert \flag-negate{foo} into something nicer.78 let doc = super::render_custom_markup(&doc, "flag-negate", |name, out| {
32 unmodified lines
modified:crates/core/flags/defs.rs+3 added-3 removed
5574 unmodified lines
5575 #!/bin/sh5576 pdftotext "$1" -5577.EE5578.sp5579then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP \fB--pre-glob5580'\fP\fI*.pdf\fP\fB'\fP to make it so ripgrep only executes the5581\fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension.5579then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP5580\fB\-\-pre\-glob\fP '\fI*.pdf\fP' to make it so ripgrep only executes5581the \fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension.5582.sp5583Multiple \flag{pre-glob} flags may be used. Globbing rules match5584\fBgitignore\fP globs. Precede a glob with a \fB!\fP to exclude it.5585.sp
2163 unmodified lines
modified:CHANGELOG.md+2 added
25 unmodified lines
26* [BUG #2990](https://github.com/BurntSushi/ripgrep/issues/2990):27 Fix a bug where ripgrep would mishandle globs that ended with a `.`.28* [BUG #3108](https://github.com/BurntSushi/ripgrep/issues/3108):29 Fix a bug where `-q --files-without-match` inverted the exit code.30* [BUG #3140](https://github.com/BurntSushi/ripgrep/issues/3140):31 Ensure hyphens in flag names are escaped in the roff text for the man page.3233Feature enhancements:3435* Many enhancements to the default set of file types available for filtering.
1733 unmodified lines