return entire tag data structure for iterating

develop
myk002 2022-07-19 22:13:53 -07:00
parent 66b7bcaf1a
commit e3588cf49c
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 9 additions and 6 deletions

@ -186,8 +186,10 @@ local function update_entry(entry, iterator, opts)
table.insert(lines, line) table.insert(lines, line)
::continue:: ::continue::
end end
if #lines > 0 then
entry.long_help = table.concat(lines, '\n') entry.long_help = table.concat(lines, '\n')
end end
end
-- create db entry based on parsing sphinx-rendered help text -- create db entry based on parsing sphinx-rendered help text
local function make_rendered_entry(old_entry, entry_name, entry_types) local function make_rendered_entry(old_entry, entry_name, entry_types)
@ -457,13 +459,13 @@ function get_tags()
return set_to_sorted_list(tag_index) return set_to_sorted_list(tag_index)
end end
-- returns the description associated with the given tag function get_tag_data(tag)
function get_tag_description(tag)
ensure_db() ensure_db()
if not tag_index[tag] then if not tag_index[tag] then
error('invalid tag: ' .. tag) dfhack.printerr('invalid tag: ' .. tag)
return {}
end end
return tag_index[tag].description return tag_index[tag]
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@ -621,7 +623,8 @@ function tags()
local tags = get_tags() local tags = get_tags()
local width = get_max_width(tags, 10) local width = get_max_width(tags, 10)
for _,tag in ipairs(tags) do for _,tag in ipairs(tags) do
print((' %-'..width..'s %s'):format(tag, get_tag_description(tag))) print((' %-'..width..'s %s'):format(tag,
get_tag_data(tag).description))
end end
end end