ensure we pick up the plugin help entry

even when it has a command and that command is not equal to the plugin
name
develop
myk002 2022-07-20 12:34:40 -07:00
parent 1cad77601e
commit 0dd153cc0d
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 9 additions and 9 deletions

@ -293,25 +293,25 @@ local function scan_plugins(old_db, db)
local plugin_names = dfhack.internal.listPlugins() local plugin_names = dfhack.internal.listPlugins()
for _,plugin in ipairs(plugin_names) do for _,plugin in ipairs(plugin_names) do
local commands = dfhack.internal.listCommands(plugin) local commands = dfhack.internal.listCommands(plugin)
if #commands == 0 then local includes_plugin = false
-- use plugin name as the command so we have something to anchor the
-- documentation to
update_db(old_db, db,
has_rendered_help(plugin) and
HELP_SOURCES.RENDERED or HELP_SOURCES.STUB,
plugin, {entry_types={[ENTRY_TYPES.PLUGIN]=true}})
goto continue
end
for _,command in ipairs(commands) do for _,command in ipairs(commands) do
local entry_types = {[ENTRY_TYPES.COMMAND]=true} local entry_types = {[ENTRY_TYPES.COMMAND]=true}
if command == plugin then if command == plugin then
entry_types[ENTRY_TYPES.PLUGIN]=true entry_types[ENTRY_TYPES.PLUGIN]=true
includes_plugin = true
end end
update_db(old_db, db, update_db(old_db, db,
has_rendered_help(command) and has_rendered_help(command) and
HELP_SOURCES.RENDERED or HELP_SOURCES.PLUGIN, HELP_SOURCES.RENDERED or HELP_SOURCES.PLUGIN,
command, {entry_types=entry_types}) command, {entry_types=entry_types})
end end
if not includes_plugin then
update_db(old_db, db,
has_rendered_help(plugin) and
HELP_SOURCES.RENDERED or HELP_SOURCES.STUB,
plugin, {entry_types={[ENTRY_TYPES.PLUGIN]=true}})
goto continue
end
::continue:: ::continue::
end end
end end