From eb9d41d52ea5168284472a7290bce7a579ba1794 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 24 Jul 2014 22:00:28 +0200 Subject: [conf,tool] implement configuration writer Now ``luaotfload-tool --dumpconf`` can be used to output the current configuration to a file. --- src/luaotfload-tool.lua | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 754f5c7..02c5a45 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -6,7 +6,7 @@ -- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang -- VERSION: 2.5 -- LICENSE: GPL v2.0 --- MODIFIED: 2014-07-24 22:07:35+0200 +-- MODIFIED: 2014-07-24 22:10:32+0200 ----------------------------------------------------------------------- luaotfload = luaotfload or { } @@ -739,9 +739,10 @@ set. --]]-- local action_sequence = { - "config", "loglevel", "help", "version", - "diagnose", "blacklist", "cache", "flush", - "bisect", "generate", "list", "query", + "config" , "loglevel" , "help" , "version" , + "dumpconf" , "diagnose" , "blacklist" , "cache" , + "flush" , "bisect" , "generate" , "list" , + "query" , } local action_pending = tabletohash(action_sequence, false) @@ -781,6 +782,11 @@ actions.version = function (job) return true, false end +actions.dumpconf = function (job) + config.actions.dump () + return true, false +end + actions.help = function (job) help_msg (job.help_version or "luaotfload-tool") return true, false @@ -1413,6 +1419,7 @@ local process_cmdline = function ( ) -- unit -> jobspec cache = 1, conf = 1, diagnose = 1, + dumpconf = 0, ["dry-run"] = "D", ["flush-lookups"] = "l", fields = 1, @@ -1551,15 +1558,20 @@ local process_cmdline = function ( ) -- unit -> jobspec result.bisect = optarg[n] action_pending.bisect = true elseif v == "conf" then - local extra = stringexplode (optarg[n], ",+") - if extra then - local extra_config = result.extra_config - if extra_config then - table.append (extra_config, extra) - else - result.extra_config = extra + local confname = optarg[n] + if confname then + local extra = stringexplode (optarg[n], ",+") + if extra then + local extra_config = result.extra_config + if extra_config then + table.append (extra_config, extra) + else + result.extra_config = extra + end end end + elseif v == "dumpconf" then + action_pending["dumpconf"] = true elseif v == "print-conf" then result.print_config = true end -- cgit v1.2.3