From da60f186c8ebce0abd9c99bcde0c00b8a105e710 Mon Sep 17 00:00:00 2001 From: YPCrumble Date: Wed, 21 Dec 2016 12:46:11 -0500 Subject: [PATCH 1/2] Update docs to explain use of -g and --files to search for paths. --- README.md | 6 ++++++ doc/rg.1 | 16 ++++++++++++++-- doc/rg.1.md | 12 ++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dee58f98c..a7e0c01e9 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,12 @@ Or exclude files matching a particular glob: $ rg foo -g '!*.min.js' ``` +Search and return paths matching a particular glob (i.e., `-g` flag in ag/ack): + +``` +$ rg -g 'doc*' --files +``` + Search only HTML and CSS files: ``` diff --git a/doc/rg.1 b/doc/rg.1 index b6ea695c4..d89d7d930 100644 --- a/doc/rg.1 +++ b/doc/rg.1 @@ -1,6 +1,6 @@ -.\" Automatically generated by Pandoc 1.18 +.\" Automatically generated by Pandoc 1.19.1 .\" -.TH "rg" "1" +.TH "" "" "" "" "" .hy .SH NAME .PP @@ -69,6 +69,14 @@ Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a \[aq]!\[aq] to exclude it. .RS +.PP +Values given to \-g must be quoted or your shell will expand them and +result in unexpected behavior. +.PP +Combine with the \-\-files flag to return matched filenames (i.e., to +replicate ack/ag\[aq]s \-g flag). +.PP +For example: rg \-g \[aq]\[aq] \-\-files .RE .TP .B \-h, \-\-help @@ -202,6 +210,10 @@ counted as part of the pattern. .B \-\-files Print each file that would be searched (but don\[aq]t search). .RS +.PP +Combine with the \-g flag to return matched paths, for example: +.PP +rg \-g \[aq]\[aq] \-\-files .RE .TP .B \-l, \-\-files\-with\-matches diff --git a/doc/rg.1.md b/doc/rg.1.md index 466a35395..295778c96 100644 --- a/doc/rg.1.md +++ b/doc/rg.1.md @@ -52,6 +52,14 @@ Project home page: https://github.com/BurntSushi/ripgrep overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a '!' to exclude it. + Values given to -g must be quoted or your shell will expand them and result + in unexpected behavior. + + Combine with the --files flag to return matched filenames + (i.e., to replicate ack/ag's -g flag). + + For example: rg -g '' --files + -h, --help : Show this usage message. @@ -136,6 +144,10 @@ Project home page: https://github.com/BurntSushi/ripgrep --files : Print each file that would be searched (but don't search). + Combine with the -g flag to return matched paths, for example: + + rg -g '' --files + -l, --files-with-matches : Only show path of each file with matches. From b5b5261894ae30d2e61f99e39bd154840d9fcb21 Mon Sep 17 00:00:00 2001 From: YPCrumble Date: Wed, 21 Dec 2016 19:29:43 -0500 Subject: [PATCH 2/2] Use 'glob' rather than 'pattern' for -g flag in docs. Fixes #284 --- doc/rg.1 | 4 ++-- doc/rg.1.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/rg.1 b/doc/rg.1 index d89d7d930..f75956716 100644 --- a/doc/rg.1 +++ b/doc/rg.1 @@ -76,7 +76,7 @@ result in unexpected behavior. Combine with the \-\-files flag to return matched filenames (i.e., to replicate ack/ag\[aq]s \-g flag). .PP -For example: rg \-g \[aq]\[aq] \-\-files +For example: rg \-g \[aq]\[aq] \-\-files .RE .TP .B \-h, \-\-help @@ -213,7 +213,7 @@ Print each file that would be searched (but don\[aq]t search). .PP Combine with the \-g flag to return matched paths, for example: .PP -rg \-g \[aq]\[aq] \-\-files +rg \-g \[aq]\[aq] \-\-files .RE .TP .B \-l, \-\-files\-with\-matches diff --git a/doc/rg.1.md b/doc/rg.1.md index 295778c96..3dc1a4435 100644 --- a/doc/rg.1.md +++ b/doc/rg.1.md @@ -58,7 +58,7 @@ Project home page: https://github.com/BurntSushi/ripgrep Combine with the --files flag to return matched filenames (i.e., to replicate ack/ag's -g flag). - For example: rg -g '' --files + For example: rg -g '\' --files -h, --help : Show this usage message. @@ -146,7 +146,7 @@ Project home page: https://github.com/BurntSushi/ripgrep Combine with the -g flag to return matched paths, for example: - rg -g '' --files + rg -g '\' --files -l, --files-with-matches : Only show path of each file with matches.