diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-04-25 11:03:07 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-04-25 11:03:07 -0400 |
commit | 86e248270509d5772286fa9ae245e1fc097e9401 (patch) | |
tree | 596b0df3ba6170ee760a1834679ae77d40f5831a /src | |
parent | 01538df8fe4eb67b724cdb84f9d507530d707a25 (diff) | |
download | lite-xl-plugin-manager-86e248270509d5772286fa9ae245e1fc097e9401.tar.gz lite-xl-plugin-manager-86e248270509d5772286fa9ae245e1fc097e9401.zip |
Added in declarative managed plugin functionality to plugin_maanger.
Diffstat (limited to 'src')
-rw-r--r-- | src/lpm.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index 81d5af8..4413148 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1473,16 +1473,21 @@ function Bottle:apply(addons, config) local changes = false local applying = {} local applied = {} + local installed = {} - for i, addon in ipairs(addons) do - if not addon:is_core() and not addon:is_installed(self) then - addon:install(self, applying) + for i, addons in ipairs(addons) do + local installed_addons = common.grep(addons, function(addon) return addon:is_installed(self) or addon:is_core(self) end) + if #installed_addons == 0 then + addons[1]:install(self, applying) changes = true + table.insert(installed, addons[1]) + else + table.insert(installed, installed_addons[1]) end - applied[addon.id] = true + applied[addons[1].id] = true end for i, addon in pairs(self:installed_addons()) do - if #common.grep(addons, function(p) return p:depends_on(addon) end) == 0 then + if #common.grep(installed, function(p) return p:depends_on(addon) end) == 0 then if not applied[addon.id] and not addon:is_core(self) and not addon:is_bundled(self) then addon:uninstall(self) changes = true |