summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Kerins <ianskerins@gmail.com>2017-01-01 19:32:46 -0500
committerAndrew Gallant <jamslam@gmail.com>2017-01-07 18:14:24 -0500
commited01e80a796b7f5cbc83c63517d884d85f1cebd7 (patch)
tree0b5cb1e71f6ce96f914357bdb617719541d94078 /src
parent8f7b9be356c005435f5612904f38ed5d95cc2aa0 (diff)
Provide a mechanism to compose type definitions
This extends the syntax of the --type-add flag to allow including the globs of other already defined types. Fixes #83.
Diffstat (limited to 'src')
-rw-r--r--src/app.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/app.rs b/src/app.rs
index d262e5de..ff61c0a3 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -450,11 +450,24 @@ lazy_static! {
globs defined inside of ripgrep.\n\nNote that this MUST be \
passed to every invocation of ripgrep. Type settings are NOT \
persisted.\n\nExample: \
- rg --type-add 'foo:*.foo' -tfoo PATTERN.");
+ rg --type-add 'foo:*.foo' -tfoo PATTERN.\n\n\
+ --type-add can also be used to include rules from other types \
+ with the special include directive. The include directive \
+ permits specifying one or more other type names (separated by a \
+ comma) that have been defined and its rules will automatically \
+ be imported into the type specified. For example, to create a \
+ type called src that matches C++, Python and Markdown files, one \
+ can use:\n\n\
+ --type-add 'src:include:cpp,py,md'\n\n\
+ Additional glob rules can still be added to the src type by \
+ using the --type-add flag again:\n\n\
+ --type-add 'src:include:cpp,py,md' --type-add 'src:*.foo'\n\n\
+ Note that type names must consist only of Unicode letters or \
+ numbers. Punctuation characters are not allowed.");
doc!(h, "type-clear",
"Clear globs for given file type.",
"Clear the file type globs previously defined for TYPE. This \
- only clears the default tpye definitions that are found inside \
+ only clears the default type definitions that are found inside \
of ripgrep.\n\nNote that this MUST be passed to every \
invocation of ripgrep. Type settings are NOT persisted.");