Skip to content

Commit

Permalink
doc: clarify --with-filename behavior with --heading
Browse files Browse the repository at this point in the history
  • Loading branch information
dfabulich authored and BurntSushi committed Sep 6, 2017
1 parent f9cbf7d commit beb010d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion complete/_rg
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ _rg() {
'*'{-u,--unrestricted}'[reduce level of "smart" searching]'
'(: -)'{-V,--version}'[display version information]'
'(-p --heading --no-heading --pretty)--vimgrep[show results in vim-compatible format]'
'(-H --no-filename --with-filename)'{-H,--with-filename}'[prefix each match with name of file that contains it]'
'(-H --no-filename --with-filename)'{-H,--with-filename}'[display the file name for matches]'
'(-w -x --line-regexp --word-regexp)'{-w,--word-regexp}'[only show matches surrounded by word boundaries]'
'(-e -f --file --files --regexp --type-list)1: :_rg_pattern'
'(--type-list)*:file:_files'
Expand Down
5 changes: 4 additions & 1 deletion doc/rg.1
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@ Only show path of each file with no matches.
.RE
.TP
.B \-H, \-\-with\-filename
Prefix each match with the file name that contains it.
Display the file name for matches.
This is the default when more than one file is searched.
If \-\-heading is enabled, the file name will be shown above clusters of
matches from each file; otherwise, the file name will be shown on each
match.
.RS
.RE
.TP
Expand Down
6 changes: 4 additions & 2 deletions doc/rg.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ Project home page: https://github.com/BurntSushi/ripgrep
: Only show path of each file with no matches.

-H, --with-filename
: Prefix each match with the file name that contains it. This is the
default when more than one file is searched.
: Display the file name for matches. This is the default when
more than one file is searched. If --heading is enabled, the
file name will be shown above clusters of matches from each
file; otherwise, the file name will be shown on each match.

--no-filename
: Never show the filename for a match. This is the default when
Expand Down
6 changes: 4 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,10 @@ lazy_static! {
"Only show the paths that contains zero matches.");
doc!(h, "with-filename",
"Show file name for each match.",
"Prefix each match with the file name that contains it. This is \
the default when more than one file is searched.");
"Display the file name for matches. This is the default when \
more than one file is searched. If --heading is enabled, the \
file name will be shown above clusters of matches from each \
file; otherwise, the file name will be shown on each match.");
doc!(h, "no-filename",
"Never show the file name for a match.",
"Never show the file name for a match. This is the default when \
Expand Down

0 comments on commit beb010d

Please sign in to comment.