aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-04-20 13:56:50 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-04-20 13:56:50 -0400
commitf52dee20847413e626ba0a6628ea86c688a038df (patch)
tree75b1a5d0631e9a04d63d67578c22c829ec6e461a /src/lpm.lua
parentad9af0bde674b4b5cfa8db4579da769a4cd63d33 (diff)
downloadlite-xl-plugin-manager-f52dee20847413e626ba0a6628ea86c688a038df.tar.gz
lite-xl-plugin-manager-f52dee20847413e626ba0a6628ea86c688a038df.zip
Made it so that we can access `extra` fields. Closes #107.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index b74e81f..7469c34 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1930,6 +1930,7 @@ local function print_addon_info(type, addons, filters)
remote = addon.remote,
description = addon.description,
author = addon.extra and addon.extra.author or (addon:is_core(system_bottle) and "lite-xl") or nil,
+ extra = addon.extra,
mod_version = addon.mod_version or LATEST_MOD_VERSION,
tags = addon.tags,
type = addon.type,
@@ -1953,9 +1954,20 @@ local function print_addon_info(type, addons, filters)
if TABLE then
local addons = common.grep(sorted, function(addon) return addon.status ~= "incompatible" end)
print(get_table(HEADER or common.map(TABLE, function(header)
- return ("" .. header:gsub("^%l", string.upper):gsub("_", " "))
+ return ("" .. header:gsub("^.*%.", ""):gsub("^%l", string.upper):gsub("_", " "))
end), common.map(result[plural], function(addon)
- return common.map(TABLE, function(header) return _G.type(header) == "function" and header(addon) or addon[header] or "" end)
+ return common.map(TABLE, function(header)
+ if _G.type(header) == "function" then
+ return header(addon)
+ else
+ local t = addon
+ for i,v in ipairs({ common.split("%.", header) }) do
+ t = t[v]
+ if _G.type(t) ~= "table" then break end
+ end
+ return t or ""
+ end
+ end)
end)))
elseif RAW then
local addons = common.grep(sorted, function(addon) return addon.status ~= "incompatible" end)