aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-09-17 15:31:48 -0400
committerAdam Harrison <adamdharrison@gmail.com>2023-09-17 15:31:48 -0400
commita86e68e26cc3e22077d1e0edc42c157fc3fc3f9b (patch)
tree6872a1fb61250d8d283def1d4599c2e589fdd3a6
parent01df6a67ea4d50dbf21a78bb94c5cc0d2c0f1b6d (diff)
downloadlite-xl-plugin-manager-a86e68e26cc3e22077d1e0edc42c157fc3fc3f9b.tar.gz
lite-xl-plugin-manager-a86e68e26cc3e22077d1e0edc42c157fc3fc3f9b.zip
Prioritized remote definitions.
-rw-r--r--src/lpm.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index d6929d4..2db54a5 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -2281,16 +2281,16 @@ not commonly used publically.
if #addons == 0 then return end
table.sort(addons, function(a,b) return string.lower(a.name or a.id) < string.lower(b.name or b.id) end)
local ids = common.map(addons, function(addon)
+ if addon.remote then return string.format("[`%s`](%s)\\*", addon.name or addon.id, addon.remote:gsub(":%w+$", "")) end
+ if addon.url then return string.format("[`%s`](%s)\\*", addon.name or addon.id, addon.url) end
if addon.path and addon.path:find(".lua$") then return string.format("[`%s`](%s?raw=1)", addon.name or addon.id, addon.path) end
if addon.path then return string.format("[`%s`](%s)", addon.name or addon.id, addon.path) end
- if addon.url then return string.format("[`%s`](%s)\\*", addon.name or addon.id, addon.url) end
- if addon.remote then return string.format("[`%s`](%s)\\*", addon.name or addon.id, addon.remote:gsub(":%w+$", "")) end
return addon.name or addon.id
end)
local descriptions = common.map(addons, function(e) return e.description or "" end)
local max_description = math.max(table.unpack(common.map(descriptions, function(e) return #e end)))
local max_id = math.max(table.unpack(common.map(ids, function(e) return #e end)))
- local type_name = ARGS["type"]:gsub("^%l", string.upper) or "Addon"
+ local type_name = ARGS["type"] and ARGS["type"]:gsub("^%l", string.upper) or "Addon"
local t = { }
table.insert(t, "| " .. type_name .. string.rep(" ", max_id - #type_name) .. (max_description > 0 and (" | Description" .. string.rep(" ", max_description - 11)) or "") .. " |")
table.insert(t, "| :" .. string.rep("-", max_id-1) .. (max_description > 0 and (" | :" .. string.rep("-", max_description - 1)) or "") .. " |")