Skip to content

Commit 169d2e4

Browse files
telotortiumBurntSushi
authored andcommitted
doc: document all file type
This adds it to the guide and the docs for the --type flag. Fixes #1344, Closes #1472
1 parent e0e607d commit 169d2e4

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Bug fixes:
2020

2121
* [BUG #1335](https://github.com/BurntSushi/ripgrep/issues/1335):
2222
Fixes a performance bug when searching plain text files with very long lines.
23+
* [BUG #1344](https://github.com/BurntSushi/ripgrep/issues/1344):
24+
Document usage of `--type all`.
2325

2426

2527
11.0.2 (2019-08-01)

GUIDE.md

+15
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,21 @@ alias rg="rg --type-add 'web:*.{html,css,js}'"
411411
or add `--type-add=web:*.{html,css,js}` to your ripgrep configuration file.
412412
([Configuration files](#configuration-file) are covered in more detail later.)
413413

414+
#### The special `all` file type
415+
416+
A special option supported by the `--type` flag is `all`. `--type all` looks
417+
for a match in any of the supported file types listed by `--type-list`,
418+
including those added on the command line using `--type-add`. It's equivalent
419+
to the command `rg --type agda --type asciidoc --type asm ...`, where `...`
420+
stands for a list of `--type` flags for the rest of the types in `--type-list`.
421+
422+
As an example, let's suppose you have a shell script in your current directory,
423+
`my-shell-script`, which includes a shell library, `my-shell-library.bash`.
424+
Both `rg --type sh` and `rg --type all` would only search for matches in
425+
`my-shell-library.bash`, not `my-shell-script`, because the globs matched
426+
by the `sh` file type don't include files without an extension. On the
427+
other hand, `rg --type-not all` would search `my-shell-script` but not
428+
`my-shell-library.bash`.
414429

415430
### Replacements
416431

src/app.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,12 @@ fn flag_type(args: &mut Vec<RGArg>) {
24572457
const LONG: &str = long!("\
24582458
Only search files matching TYPE. Multiple type flags may be provided. Use the
24592459
--type-list flag to list all available types.
2460+
2461+
This flag supports the special value 'all', which will behave as if --type
2462+
was provided for every file type supported by ripgrep (including any custom
2463+
file types). The end result is that '--type all' causes ripgrep to search in
2464+
\"whitelist\" mode, where it will only search files it recognizes via its type
2465+
definitions.
24602466
");
24612467
let arg = RGArg::flag("type", "TYPE").short("t")
24622468
.help(SHORT).long_help(LONG)

0 commit comments

Comments
 (0)