summaryrefslogtreecommitdiff
path: root/doc/context/scripts
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-20 14:47:44 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-20 14:47:44 +0200
commit65ed578259121f17a365b97956d19d67e0be8f60 (patch)
tree30926c067de8e1b9c1a7894d328d727d05a4bb01 /doc/context/scripts
parented42bd4c79946716033bf5dbedbd54bbe81f49e8 (diff)
downloadcontext-65ed578259121f17a365b97956d19d67e0be8f60.tar.gz
2016-08-20 13:44:00
Diffstat (limited to 'doc/context/scripts')
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.html12
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.man9
-rw-r--r--doc/context/scripts/mkiv/mtx-grep.xml16
3 files changed, 36 insertions, 1 deletions
diff --git a/doc/context/scripts/mkiv/mtx-grep.html b/doc/context/scripts/mkiv/mtx-grep.html
index 45a32f987..3ba8e8547 100644
--- a/doc/context/scripts/mkiv/mtx-grep.html
+++ b/doc/context/scripts/mkiv/mtx-grep.html
@@ -42,10 +42,20 @@
<tr><th>--pattern</th><td></td><td>search for pattern (optional)</td></tr>
<tr><th>--count</th><td></td><td>count matches only</td></tr>
<tr><th>--nocomment</th><td></td><td>skip lines that start with %% or #</td></tr>
+ <tr><th>--n</th><td></td><td>show at most n matches</td></tr>
+ <tr><th>--first</th><td></td><td>only show first match</td></tr>
+ <tr><th>--match</th><td></td><td>return the match (if it is one)</td></tr>
<tr><th>--xml</th><td></td><td>pattern is lpath expression</td></tr>
</table>
<br/>
- </div>
+<h1>Examples</h1>
+<tt>mtxrun --script grep --pattern=module *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern="modules.-%['(.-)'%]" char-*.lua --first</tt>
+<br/><tt>mtxrun --script grep --pattern=module --count *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --first *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --nocomment *.mkiv</tt>
+<br/><tt>mtxrun --script grep --pattern=module --n=10 *.mkiv</tt>
+<br/><br/> </div>
</div>
</body>
</html>
diff --git a/doc/context/scripts/mkiv/mtx-grep.man b/doc/context/scripts/mkiv/mtx-grep.man
index 2a3d30316..02c4db2f9 100644
--- a/doc/context/scripts/mkiv/mtx-grep.man
+++ b/doc/context/scripts/mkiv/mtx-grep.man
@@ -20,6 +20,15 @@ count matches only
.B --nocomment
skip lines that start with %% or #
.TP
+.B --n
+show at most n matches
+.TP
+.B --first
+only show first match
+.TP
+.B --match
+return the match (if it is one)
+.TP
.B --xml
pattern is lpath expression
.SH AUTHOR
diff --git a/doc/context/scripts/mkiv/mtx-grep.xml b/doc/context/scripts/mkiv/mtx-grep.xml
index d8567e035..a78565b57 100644
--- a/doc/context/scripts/mkiv/mtx-grep.xml
+++ b/doc/context/scripts/mkiv/mtx-grep.xml
@@ -11,10 +11,26 @@
<flag name="pattern"><short>search for pattern (optional)</short></flag>
<flag name="count"><short>count matches only</short></flag>
<flag name="nocomment"><short>skip lines that start with %% or #</short></flag>
+ <flag name="n"><short>show at most n matches</short></flag>
+ <flag name="first"><short>only show first match</short></flag>
+ <flag name="match"><short>return the match (if it is one)</short></flag>
<flag name="xml"><short>pattern is lpath expression</short></flag>
</subcategory>
</category>
</flags>
+ <examples>
+ <category>
+ <title>Examples</title>
+ <subcategory>
+ <example><command>mtxrun --script grep --pattern=module *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern="modules.-%['(.-)'%]" char-*.lua --first</command></example>
+ <example><command>mtxrun --script grep --pattern=module --count *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --first *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --nocomment *.mkiv</command></example>
+ <example><command>mtxrun --script grep --pattern=module --n=10 *.mkiv</command></example>
+ </subcategory>
+ </category>
+ </examples>
<comments>
<comment>patterns are lua patterns and need to be escaped accordingly</comment>
</comments>