tools/script_manager - fixed metadata decoding to get rid of spurious

commas
This commit is contained in:
Bill Ferguson
2024-05-15 21:33:29 -04:00
parent f6916c3a15
commit 284c0f9714

View File

@@ -60,7 +60,7 @@ local gettext = dt.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("script_manager",dt.configuration.config_dir.."/lua/locale/")
dt.gettext.bindtextdomain("script_manager",dt.configuration.config_dir.."/lua/locale/")
local function _(msgid)
return gettext.dgettext("script_manager", msgid)
@@ -380,6 +380,10 @@ local function string_dei18n(str)
return string.match(str, "%_%((.+)%)")
end
local function string_chop(str)
return str:sub(1, -2)
end
------------------
-- script handling
------------------
@@ -431,6 +435,9 @@ local function get_script_metadata(script)
else
parts[2] = string_dequote(parts[2])
end
if string.match(parts[2], ",$") then
parts[2] = string_chop(parts[2])
end
metadata = metadata .. string.format("%s%-10s\t%s", first and "" or "\n", parts[1], parts[2])
first = nil
end
@@ -438,6 +445,7 @@ local function get_script_metadata(script)
end
restore_log_level(old_log_level)
dt.print_log(metadata)
return metadata
end