Skip to content

Commit 34c0b1b

Browse files
okdanaBurntSushi
authored andcommitted
doc: various updates
* Don't use 'smart typography' when generating man page * Document PATTERN and PATH * Capitalise place-holder names consistently * Add note about PATH overriding glob/ignore rules * Update args.rs for new PATH capitalisation Fixes #725
1 parent 74e96b4 commit 34c0b1b

File tree

5 files changed

+49
-23
lines changed

5 files changed

+49
-23
lines changed

doc/convert-to-man

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh -e
22

3-
pandoc -s -t man rg.1.md -o rg.1
3+
pandoc -s -f markdown-smart -t man rg.1.md -o rg.1
44
sed -i.bak 's/\.TH.*/.TH "rg" "1"/g' rg.1
55
rm -f rg.1.bak # BSD `sed` requires the creation of a back-up file

doc/rg.1

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 1.19.2.1
1+
.\" Automatically generated by Pandoc 2.0.6
22
.\"
33
.TH "rg" "1"
44
.hy
@@ -7,18 +7,18 @@
77
rg \- recursively search current directory for lines matching a pattern
88
.SH SYNOPSIS
99
.PP
10-
rg [\f[I]options\f[]] \f[I]PATTERN\f[] [\f[I]path\f[] ...]
10+
rg [\f[I]OPTIONS\f[]] \f[I]PATTERN\f[] [\f[I]PATH\f[] ...]
1111
.PP
12-
rg [\f[I]options\f[]] [\-e \f[I]PATTERN\f[] ...] [\-f \f[I]FILE\f[] ...]
13-
[\f[I]path\f[] ...]
12+
rg [\f[I]OPTIONS\f[]] [\-e \f[I]PATTERN\f[] ...] [\-f \f[I]FILE\f[] ...]
13+
[\f[I]PATH\f[] ...]
1414
.PP
15-
rg [\f[I]options\f[]] \-\-files [\f[I]path\f[] ...]
15+
rg [\f[I]OPTIONS\f[]] \-\-files [\f[I]PATH\f[] ...]
1616
.PP
17-
rg [\f[I]options\f[]] \-\-type\-list
17+
rg [\f[I]OPTIONS\f[]] \-\-type\-list
1818
.PP
19-
rg [\f[I]options\f[]] \-\-help
19+
rg [\f[I]OPTIONS\f[]] \-\-help
2020
.PP
21-
rg [\f[I]options\f[]] \-\-version
21+
rg [\f[I]OPTIONS\f[]] \-\-version
2222
.SH DESCRIPTION
2323
.PP
2424
ripgrep (rg) combines the usability of The Silver Searcher (an ack
@@ -34,6 +34,21 @@ it searches a file that is simultaneously truncated.
3434
This behavior can be avoided by passing the \-\-no\-mmap flag.
3535
.PP
3636
Project home page: https://github.com/BurntSushi/ripgrep
37+
.SH POSITIONAL ARGUMENTS
38+
.TP
39+
.B \f[I]PATTERN\f[]
40+
A regular expression used for searching.
41+
To match a pattern beginning with a dash, use the \-e/\-\-regexp option.
42+
.RS
43+
.RE
44+
.TP
45+
.B \f[I]PATH\f[]
46+
A file or directory to search.
47+
Directories are searched recursively.
48+
Paths specified expicitly on the command line override glob and ignore
49+
rules.
50+
.RS
51+
.RE
3752
.SH COMMON OPTIONS
3853
.TP
3954
.B \-a, \-\-text

doc/rg.1.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ rg - recursively search current directory for lines matching a pattern
44

55
# SYNOPSIS
66

7-
rg [*options*] *PATTERN* [*path* ...]
7+
rg [*OPTIONS*] *PATTERN* [*PATH* ...]
88

9-
rg [*options*] [-e *PATTERN* ...] [-f *FILE* ...] [*path* ...]
9+
rg [*OPTIONS*] [-e *PATTERN* ...] [-f *FILE* ...] [*PATH* ...]
1010

11-
rg [*options*] --files [*path* ...]
11+
rg [*OPTIONS*] --files [*PATH* ...]
1212

13-
rg [*options*] --type-list
13+
rg [*OPTIONS*] --type-list
1414

15-
rg [*options*] --help
15+
rg [*OPTIONS*] --help
1616

17-
rg [*options*] --version
17+
rg [*OPTIONS*] --version
1818

1919
# DESCRIPTION
2020

@@ -31,6 +31,16 @@ by passing the --no-mmap flag.
3131

3232
Project home page: https://github.com/BurntSushi/ripgrep
3333

34+
# POSITIONAL ARGUMENTS
35+
36+
*PATTERN*
37+
: A regular expression used for searching. To match a pattern beginning with a
38+
dash, use the -e/--regexp option.
39+
40+
*PATH*
41+
: A file or directory to search. Directories are searched recursively. Paths
42+
specified expicitly on the command line override glob and ignore rules.
43+
3444
# COMMON OPTIONS
3545

3646
-a, --text

src/app.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Project home page: https://github.com/BurntSushi/ripgrep
1818
Use -h for short descriptions and --help for more details.";
1919

2020
const USAGE: &str = "
21-
rg [options] PATTERN [path ...]
22-
rg [options] [-e PATTERN ...] [-f FILE ...] [path ...]
23-
rg [options] --files [path ...]
24-
rg [options] --type-list";
21+
rg [OPTIONS] PATTERN [PATH ...]
22+
rg [OPTIONS] [-e PATTERN ...] [-f FILE ...] [PATH ...]
23+
rg [OPTIONS] --files [PATH ...]
24+
rg [OPTIONS] --type-list";
2525

2626
const TEMPLATE: &str = "\
2727
{bin} {version}
@@ -67,7 +67,7 @@ pub fn app() -> App<'static, 'static> {
6767
"file", "files", "help-short", "help", "regexp", "type-list",
6868
"ripgrep-version",
6969
]))
70-
.arg(arg("path").multiple(true))
70+
.arg(arg("PATH").multiple(true))
7171
.arg(flag("regexp").short("e")
7272
.takes_value(true).multiple(true).number_of_values(1)
7373
.set(ArgSettings::AllowLeadingHyphen)
@@ -247,10 +247,11 @@ lazy_static! {
247247
"Use pattern to search. This option can be provided multiple \
248248
times, where all patterns given are searched. This is also \
249249
useful when searching for patterns that start with a dash.");
250-
doc!(h, "path",
250+
doc!(h, "PATH",
251251
"A file or directory to search.",
252252
"A file or directory to search. Directories are searched \
253-
recursively.");
253+
recursively. Paths specified on the command line override glob \
254+
and ignore rules.");
254255
doc!(h, "files",
255256
"Print each file that would be searched.",
256257
"Print each file that would be searched without actually \

src/args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl<'a> ArgMatches<'a> {
371371

372372
/// Return all file paths that ripgrep should search.
373373
fn paths(&self) -> Vec<PathBuf> {
374-
let mut paths: Vec<PathBuf> = match self.values_of_os("path") {
374+
let mut paths: Vec<PathBuf> = match self.values_of_os("PATH") {
375375
None => vec![],
376376
Some(vals) => vals.map(|p| Path::new(p).to_path_buf()).collect(),
377377
};

0 commit comments

Comments
 (0)