summaryrefslogtreecommitdiffstats
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/rg.133
-rw-r--r--doc/rg.1.md20
2 files changed, 50 insertions, 3 deletions
diff --git a/doc/rg.1 b/doc/rg.1
index 7b87ea40..1f29c8f0 100644
--- a/doc/rg.1
+++ b/doc/rg.1
@@ -397,9 +397,38 @@ inside of ripgrep.
Note that this must be passed to every invocation of rg.
Type settings are NOT persisted.
.RS
+.IP
+.nf
+\f[C]
+\ \ Example:\ `rg\ \-\-type\-add\ \[aq]foo:*.foo\[aq]\ \-tfoo\ PATTERN`
+\f[]
+.fi
.PP
-Example:
-\f[C]rg\ \-\-type\-add\ \[aq]foo:*.foo\[aq]\ \-tfoo\ PATTERN\f[]
+\-\-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:
+.IP
+.nf
+\f[C]
+\ \ `\-\-type\-add\ \[aq]src:include:cpp,py,md\[aq]`
+\f[]
+.fi
+.PP
+Additional glob rules can still be added to the src type by using the
+\-\-type\-add flag again:
+.IP
+.nf
+\f[C]
+\ \ `\-\-type\-add\ \[aq]src:include:cpp,py,md\[aq]\ \-\-type\-add\ \[aq]src:*.foo\[aq]`
+\f[]
+.fi
+.PP
+Note that type names must consist only of Unicode letters or numbers.
+Punctuation characters are not allowed.
.RE
.TP
.B \-\-type\-clear \f[I]TYPE\f[] ...
diff --git a/doc/rg.1.md b/doc/rg.1.md
index 0bd08504..b920c0ef 100644
--- a/doc/rg.1.md
+++ b/doc/rg.1.md
@@ -267,7 +267,25 @@ Project home page: https://github.com/BurntSushi/ripgrep
this must be passed to every invocation of rg. Type settings are NOT
persisted.
- Example: `rg --type-add 'foo:*.foo' -tfoo PATTERN`
+ Example: `rg --type-add 'foo:*.foo' -tfoo PATTERN`
+
+ --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:
+
+ `--type-add 'src:include:cpp,py,md'`
+
+ Additional glob rules can still be added to the src type by
+ using the --type-add flag again:
+
+ `--type-add 'src:include:cpp,py,md' --type-add 'src:*.foo'`
+
+ Note that type names must consist only of Unicode letters or
+ numbers. Punctuation characters are not allowed.
--type-clear *TYPE* ...
: Clear the file type globs previously defined for TYPE. This only clears