diff options
author | Marius <mariausol@gmail.com> | 2011-02-08 12:00:13 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-02-08 12:00:13 +0200 |
commit | 9c6992a3436a0db6a01790b29d7c0c3c65460f94 (patch) | |
tree | c384372b23cfb6a5379641b4857bae07057bb3be /scripts/context/lua/mtx-grep.lua | |
parent | 801c806a2489c5c96578fe95945bef589329c4e0 (diff) | |
download | context-9c6992a3436a0db6a01790b29d7c0c3c65460f94.tar.gz |
beta 2011.02.08 10:06
Diffstat (limited to 'scripts/context/lua/mtx-grep.lua')
-rw-r--r-- | scripts/context/lua/mtx-grep.lua | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/scripts/context/lua/mtx-grep.lua b/scripts/context/lua/mtx-grep.lua index 98378f92b..963422c68 100644 --- a/scripts/context/lua/mtx-grep.lua +++ b/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") - 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 |