diff --git a/CHANGELOG.md b/CHANGELOG.md index e0d3e662..70813aaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ Bug fixes: * [BUG #1335](https://github.com/BurntSushi/ripgrep/issues/1335): Fixes a performance bug when searching plain text files with very long lines. +* [BUG #1344](https://github.com/BurntSushi/ripgrep/issues/1344): + Document usage of `--type all`. 11.0.2 (2019-08-01) diff --git a/GUIDE.md b/GUIDE.md index 914e86af..3069acf7 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -411,6 +411,21 @@ alias rg="rg --type-add 'web:*.{html,css,js}'" or add `--type-add=web:*.{html,css,js}` to your ripgrep configuration file. ([Configuration files](#configuration-file) are covered in more detail later.) +#### The special `all` file type + +A special option supported by the `--type` flag is `all`. `--type all` looks +for a match in any of the supported file types listed by `--type-list`, +including those added on the command line using `--type-add`. It's equivalent +to the command `rg --type agda --type asciidoc --type asm ...`, where `...` +stands for a list of `--type` flags for the rest of the types in `--type-list`. + +As an example, let's suppose you have a shell script in your current directory, +`my-shell-script`, which includes a shell library, `my-shell-library.bash`. +Both `rg --type sh` and `rg --type all` would only search for matches in +`my-shell-library.bash`, not `my-shell-script`, because the globs matched +by the `sh` file type don't include files without an extension. On the +other hand, `rg --type-not all` would search `my-shell-script` but not +`my-shell-library.bash`. ### Replacements diff --git a/src/app.rs b/src/app.rs index 4e0ccfc4..b72baf09 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2457,6 +2457,12 @@ fn flag_type(args: &mut Vec) { const LONG: &str = long!("\ Only search files matching TYPE. Multiple type flags may be provided. Use the --type-list flag to list all available types. + +This flag supports the special value 'all', which will behave as if --type +was provided for every file type supported by ripgrep (including any custom +file types). The end result is that '--type all' causes ripgrep to search in +\"whitelist\" mode, where it will only search files it recognizes via its type +definitions. "); let arg = RGArg::flag("type", "TYPE").short("t") .help(SHORT).long_help(LONG)