mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-03-03 14:32:22 +02:00
doc: document all
file type
This adds it to the guide and the docs for the --type flag. Fixes #1344, Closes #1472
This commit is contained in:
parent
1bdb767851
commit
24f8a3e5ec
@ -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)
|
||||
|
15
GUIDE.md
15
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
|
||||
|
||||
|
@ -2457,6 +2457,12 @@ fn flag_type(args: &mut Vec<RGArg>) {
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user