summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/lua/mtx-grep.lua
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
commitd7ccb42582f85acf30568913610ccf4d602023fb (patch)
tree7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/scripts/context/lua/mtx-grep.lua
parent2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff)
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-grep.lua')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-grep.lua28
1 files changed, 17 insertions, 11 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-grep.lua b/Master/texmf-dist/scripts/context/lua/mtx-grep.lua
index 9604bc9f85d..963422c68ec 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-grep.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-grep.lua
@@ -6,11 +6,25 @@ if not modules then modules = { } end modules ['mtx-babel'] = {
license = "see context related readme files"
}
+local helpinfo = [[
+--pattern search for pattern (optional)
+--count count matches only
+--nocomment skip lines that start with %% or #
+
+patterns are lua patterns and need to be escaped accordingly
+]]
+
+local application = logs.application {
+ name = "mtx-grep",
+ banner = "Simple Grepper 0.10",
+ helpinfo = helpinfo,
+}
+
+local report = application.report
+
scripts = scripts or { }
scripts.grep = scripts.grep or { }
-logs.extendbanner("Simple Grepper 0.10",true)
-
local find, format = string.find, string.format
local cr = lpeg.P("\r")
@@ -94,14 +108,6 @@ function scripts.grep.find(pattern, files, offset)
end
end
-messages.help = [[
---pattern search for pattern (optional)
---count count matches only
---nocomment skip lines that start with %% or #
-
-patterns are lua patterns and need to be escaped accordingly
-]]
-
local pattern = environment.argument("pattern")
local files = environment.files and #environment.files > 0 and environment.files
@@ -110,5 +116,5 @@ if pattern and files then
elseif files then
scripts.grep.find(files[1], files, 2)
else
- logs.help(messages.help)
+ application.help()
end