@@ -18,6 +18,11 @@ exec lua "$0" "$@"
1818 lua preprocess-cl.lua [options] [--] filepath1 [filepath2 ...]
1919
2020 Options:
21+ --data="Any data."
22+ A string with any data. If the option is present then the value
23+ will be available through the global 'dataFromCommandLine' in the
24+ processed files (and the message handler, if you have one).
25+
2126 --handler=pathToMessageHandler
2227 Path to a Lua file that's expected to return a function or a
2328 table of functions. If it returns a function then it will be
@@ -121,6 +126,7 @@ local outputExtension = "lua"
121126local processingInfoPath = " "
122127local silent = false
123128local outputMeta = false
129+ local customData = nil
124130
125131-- ==============================================================
126132-- = Local Functions ============================================
@@ -216,6 +222,9 @@ for _, arg in ipairs(args) do
216222 elseif arg :find " ^%-%-outputextension=" then
217223 outputExtension = arg :match " ^%-%-outputextension=(.*)$"
218224
225+ elseif arg :find " ^%-%-data=" then
226+ customData = arg :match " ^%-%-data=(.*)$"
227+
219228 elseif arg == " --meta" then
220229 outputMeta = true
221230
@@ -239,6 +248,11 @@ printfNoise(("="):rep(#header))
239248
240249
241250
251+ -- Prepare metaEnvironment.
252+ pp .metaEnvironment .dataFromCommandLine = customData -- May be nil.
253+
254+
255+
242256-- Load message handler.
243257local messageHandler = nil
244258
0 commit comments