From 13ec4b540e0d46c97fd7b089e0b7413da81e0a9f Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 19 May 2013 20:40:34 +0300 Subject: beta 2013.05.19 19:27 --- scripts/context/lua/mtx-base.lua | 268 +++++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 134 deletions(-) (limited to 'scripts/context/lua/mtx-base.lua') diff --git a/scripts/context/lua/mtx-base.lua b/scripts/context/lua/mtx-base.lua index bd6749717..66fd06624 100644 --- a/scripts/context/lua/mtx-base.lua +++ b/scripts/context/lua/mtx-base.lua @@ -1,134 +1,134 @@ -if not modules then modules = { } end modules ['mtx-base'] = { - version = 1.001, - comment = "formerly known as luatools", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local helpinfo = [[ - - - - mtx-base - ConTeXt TDS Management Tool (aka luatools) - 1.35 - - - - - generate file database - show configuration variables - show configuration order - expand complex variable - expand variable (resolve paths) - expand variable (resolve references) - show path expansion of ... - report value of variable - report file location - report path of file - [or ] make luatex format - [or ] run luatex format - assemble and compile lua inifile - give a bit more info - show all found files - filter cf format specification (default 'tex', use 'any' for any match) - filter variables - enable given trackers - - - - -]] - -local application = logs.application { - name = "mtx-base", - banner = "ConTeXt TDS Management Tool (aka luatools) 1.35", - helpinfo = helpinfo, -} - -local report = application.report - --- private option --noluc for testing errors in the stub - -local instance = resolvers.instance - -local pattern = environment.arguments["pattern"] or nil -local fileformat = environment.arguments["format"] or "" -- nil ? -local allresults = environment.arguments["all"] or false -local trace = environment.arguments["trace"] - -if type(pattern) == 'boolean' then - report("invalid pattern specification") - pattern = nil -end - -if trace then - resolvers.settrace(trace) -- move to mtxrun ? -end - -if environment.arguments["find-file"] then - resolvers.load() - if pattern then - resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) - else - resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) - end -elseif environment.arguments["find-path"] then - resolvers.load() - local path = resolvers.findpath(environment.files[1], fileformat) - print(path) -- quite basic, wil become function in logs -elseif environment.arguments["run"] then - resolvers.load("nofiles") -- ! no need for loading databases - trackers.enable("resolvers.locating") - environment.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "") -elseif environment.arguments["fmt"] then - resolvers.load("nofiles") -- ! no need for loading databases - trackers.enable("resolvers.locating") - environment.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "") -elseif environment.arguments["expand-braces"] then - resolvers.load("nofiles") - resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) -elseif environment.arguments["expand-path"] then - resolvers.load("nofiles") - resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) -elseif environment.arguments["expand-var"] or environment.arguments["expand-variable"] then - resolvers.load("nofiles") - resolvers.dowithfilesandreport(resolvers.expansion, environment.files) -elseif environment.arguments["show-path"] or environment.arguments["path-value"] then - resolvers.load("nofiles") - resolvers.dowithfilesandreport(resolvers.showpath, environment.files) -elseif environment.arguments["var-value"] or environment.arguments["show-value"] then - resolvers.load("nofiles") - resolvers.dowithfilesandreport(resolvers.variable, environment.files) -elseif environment.arguments["format-path"] then - resolvers.load() - report(caches.getwritablepath("format")) -elseif pattern then -- brrr - resolvers.load() - resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) -elseif environment.arguments["generate"] then - instance.renewcache = true - trackers.enable("resolvers.locating") - resolvers.load() -elseif environment.arguments["make"] or environment.arguments["ini"] or environment.arguments["compile"] then - resolvers.load() - trackers.enable("resolvers.locating") - environment.make_format(environment.files[1] or "") -elseif environment.arguments["variables"] or environment.arguments["show-variables"] or environment.arguments["expansions"] or environment.arguments["show-expansions"] then - resolvers.load("nofiles") - resolvers.listers.variables(pattern) -elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then - resolvers.load("nofiles") - resolvers.listers.configurations() -elseif environment.arguments["exporthelp"] then - application.export(environment.arguments["exporthelp"],environment.files[1]) -elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then - application.help() -elseif environment.files[1] == 'texmfcnf.lua' then - resolvers.load("nofiles") - resolvers.listers.configurations() -else - resolvers.load() - resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) -end +if not modules then modules = { } end modules ['mtx-base'] = { + version = 1.001, + comment = "formerly known as luatools", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local helpinfo = [[ + + + + mtx-base + ConTeXt TDS Management Tool (aka luatools) + 1.35 + + + + + generate file database + show configuration variables + show configuration order + expand complex variable + expand variable (resolve paths) + expand variable (resolve references) + show path expansion of ... + report value of variable + report file location + report path of file + [or ] make luatex format + [or ] run luatex format + assemble and compile lua inifile + give a bit more info + show all found files + filter cf format specification (default 'tex', use 'any' for any match) + filter variables + enable given trackers + + + + +]] + +local application = logs.application { + name = "mtx-base", + banner = "ConTeXt TDS Management Tool (aka luatools) 1.35", + helpinfo = helpinfo, +} + +local report = application.report + +-- private option --noluc for testing errors in the stub + +local instance = resolvers.instance + +local pattern = environment.arguments["pattern"] or nil +local fileformat = environment.arguments["format"] or "" -- nil ? +local allresults = environment.arguments["all"] or false +local trace = environment.arguments["trace"] + +if type(pattern) == 'boolean' then + report("invalid pattern specification") + pattern = nil +end + +if trace then + resolvers.settrace(trace) -- move to mtxrun ? +end + +if environment.arguments["find-file"] then + resolvers.load() + if pattern then + resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) + else + resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) + end +elseif environment.arguments["find-path"] then + resolvers.load() + local path = resolvers.findpath(environment.files[1], fileformat) + print(path) -- quite basic, wil become function in logs +elseif environment.arguments["run"] then + resolvers.load("nofiles") -- ! no need for loading databases + trackers.enable("resolvers.locating") + environment.run_format(environment.files[1] or "",environment.files[2] or "",environment.files[3] or "") +elseif environment.arguments["fmt"] then + resolvers.load("nofiles") -- ! no need for loading databases + trackers.enable("resolvers.locating") + environment.run_format(environment.arguments["fmt"], environment.files[1] or "",environment.files[2] or "") +elseif environment.arguments["expand-braces"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expandbraces, environment.files) +elseif environment.arguments["expand-path"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expandpath, environment.files) +elseif environment.arguments["expand-var"] or environment.arguments["expand-variable"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.expansion, environment.files) +elseif environment.arguments["show-path"] or environment.arguments["path-value"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.showpath, environment.files) +elseif environment.arguments["var-value"] or environment.arguments["show-value"] then + resolvers.load("nofiles") + resolvers.dowithfilesandreport(resolvers.variable, environment.files) +elseif environment.arguments["format-path"] then + resolvers.load() + report(caches.getwritablepath("format")) +elseif pattern then -- brrr + resolvers.load() + resolvers.dowithfilesandreport(resolvers.findfiles, { pattern }, fileformat, allresults) +elseif environment.arguments["generate"] then + instance.renewcache = true + trackers.enable("resolvers.locating") + resolvers.load() +elseif environment.arguments["make"] or environment.arguments["ini"] or environment.arguments["compile"] then + resolvers.load() + trackers.enable("resolvers.locating") + environment.make_format(environment.files[1] or "") +elseif environment.arguments["variables"] or environment.arguments["show-variables"] or environment.arguments["expansions"] or environment.arguments["show-expansions"] then + resolvers.load("nofiles") + resolvers.listers.variables(pattern) +elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then + resolvers.load("nofiles") + resolvers.listers.configurations() +elseif environment.arguments["exporthelp"] then + application.export(environment.arguments["exporthelp"],environment.files[1]) +elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then + application.help() +elseif environment.files[1] == 'texmfcnf.lua' then + resolvers.load("nofiles") + resolvers.listers.configurations() +else + resolvers.load() + resolvers.dowithfilesandreport(resolvers.findfiles, environment.files, fileformat, allresults) +end -- cgit v1.2.3