diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-10-13 20:10:58 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-10-13 20:10:58 -0400 |
commit | 0cfe9e3c2bcd6fabd0c446cd03d60fd7d736ce19 (patch) | |
tree | 080e1d43658765d92b280069b9d66e385c082a8a /src/lpm.lua | |
parent | c09b1224fbc618f12a92deb196e5d5c50e2bedd4 (diff) | |
download | lite-xl-plugin-manager-0cfe9e3c2bcd6fabd0c446cd03d60fd7d736ce19.tar.gz lite-xl-plugin-manager-0cfe9e3c2bcd6fabd0c446cd03d60fd7d736ce19.zip |
Only insert lite-xls in priority order.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r-- | src/lpm.lua | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index 51b09cc..5760b4e 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1715,7 +1715,9 @@ local function get_repository(url) if not url then error("requires a repository url") end local r = Repository.url(url) for i,v in ipairs(repositories) do - if (v.repo_path and v.repo_path == r.repo_path) or (v.remote and v.remote == r.remote and v.branch == r.branch and v.commit == r.commit) then return i, v end + if ((v.repo_path and v.repo_path == r.repo_path) or (v.remote and v.remote == r.remote)) and v.branch == r.branch and v.commit == r.commit then + return i, v + end end return nil end @@ -1863,17 +1865,19 @@ function lpm.lite_xl_list() for i,repo in ipairs(repositories) do if not repo.lite_xls then error("can't find lite-xl for repo " .. repo:url()) end for j, lite_xl in ipairs(repo.lite_xls) do - table.insert(result["lite-xls"], { - version = lite_xl.version, - mod_version = lite_xl.mod_version, - repository = repo:url(), - tags = lite_xl.tags, - is_system = lite_xl:is_system(), - is_installed = lite_xl:is_installed(), - status = (lite_xl:is_installed() or lite_xl:is_system()) and (lite_xl:is_local() and "local" or "installed") or "available", - local_path = lite_xl:is_installed() and lite_xl.local_path - }) - max_version = math.max(max_version, #lite_xl.version) + if not common.first(result["lite-xls"], function(l) return l.version == lite_xl.version end) then + table.insert(result["lite-xls"], { + version = lite_xl.version, + mod_version = lite_xl.mod_version, + repository = repo:url(), + tags = lite_xl.tags, + is_system = lite_xl:is_system(), + is_installed = lite_xl:is_installed(), + status = (lite_xl:is_installed() or lite_xl:is_system()) and (lite_xl:is_local() and "local" or "installed") or "available", + local_path = lite_xl:is_installed() and lite_xl.local_path + }) + max_version = math.max(max_version, #lite_xl.version) + end end end if JSON then |