@@ -19,13 +19,18 @@ exec lua "$0" "$@"
1919 OR
2020 lua preprocess-cl.lua --outputpaths [options] [--] inputpath1 outputpath1 [inputpath2 outputpath2 ...]
2121
22+ Examples:
23+ lua preprocess-cl.lua --saveinfo=misc/info.lua --silent src/main.lua2p src/network.lua2p
24+ lua preprocess-cl.lua --debug src/main.lua2p src/network.lua2p
25+ lua preprocess-cl.lua --outputpaths --linenumbers src/main.lua2p output/main.lua src/network.lua2p output/network.lua
26+
2227 Options:
23- --data="Any data."
28+ --data|-d ="Any data."
2429 A string with any data. If the option is present then the value
2530 will be available through the global 'dataFromCommandLine' in the
2631 processed files (and the message handler, if you have one).
2732
28- --handler=pathToMessageHandler
33+ --handler|-h =pathToMessageHandler
2934 Path to a Lua file that's expected to return a function or a
3035 table of functions. If it returns a function then it will be
3136 called with various messages as it's first argument. If it's
@@ -47,11 +52,11 @@ exec lua "$0" "$@"
4752 default is "lua". If any input files end in .lua then you must
4853 specify another file extension.
4954
50- --outputpaths
55+ --outputpaths|-o
5156 This flag makes every other specified path be the output path
5257 for the previous path.
5358
54- --saveinfo=pathToSaveProcessingInfoTo
59+ --saveinfo|-i =pathToSaveProcessingInfoTo
5560 Processing information includes what files had any preprocessor
5661 code in them, and things like that. The format of the file is a
5762 lua module that returns a table. Search this file for 'SavedInfo'
@@ -217,15 +222,15 @@ for _, arg in ipairs(args) do
217222 elseif arg == " --" then
218223 processOptions = false
219224
220- elseif arg :find " ^%-%-data=" then
221- customData = arg :match " ^%-%-data=(.*)$"
225+ elseif arg :find " ^%-%-data=" or arg : find " ^%-d= " then
226+ customData = arg :match " ^%-%-data=(.*)$" or arg : match " ^%-d=(.*)$ "
222227
223228 elseif arg == " --debug" then
224229 isDebug = true
225230 outputMeta = true
226231
227- elseif arg :find " ^%-%-handler=" then
228- messageHandlerPath = arg :match " ^%-%-handler=(.*)$"
232+ elseif arg :find " ^%-%-handler=" or arg : find " ^%-h= " then
233+ messageHandlerPath = arg :match " ^%-%-handler=(.*)$" or arg : match " ^%-h=(.*)$ "
229234
230235 elseif arg == " --linenumbers" then
231236 addLineNumbers = true
@@ -240,22 +245,22 @@ for _, arg in ipairs(args) do
240245 hasOutputExtension = true
241246 outputExtension = arg :match " ^%-%-outputextension=(.*)$"
242247
243- elseif arg == " --outputpaths" then
248+ elseif arg == " --outputpaths" or arg == " -o " then
244249 if hasOutputExtension then
245250 errorline (" Cannot specify both --outputpaths and --outputextension" )
246251 elseif pathsIn [1 ] then
247252 errorline (arg .. " must appear before any paths." )
248253 end
249254 hasOutputPaths = true
250255
251- elseif arg :find " ^%-%-saveinfo=" then
252- processingInfoPath = arg :match " ^%-%-saveinfo=(.*)$"
256+ elseif arg :find " ^%-%-saveinfo=" or arg : find " ^%-i= " then
257+ processingInfoPath = arg :match " ^%-%-saveinfo=(.*)$" or arg : match " ^%-i=(.*)$ "
253258
254259 elseif arg == " --silent" then
255260 silent = true
256261
257262 else
258- errorline (" Unknown option '" .. arg .. " '." )
263+ errorline (" Unknown option '" .. arg : gsub ( " =.* " , " " ) .. " '." )
259264 end
260265end
261266
0 commit comments