aboutsummaryrefslogtreecommitdiff
path: root/plugins/plugin_manager
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-04-24 18:31:58 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-04-24 18:31:58 -0400
commit3aab9d2284e8c2a7f6ccb3fa767ec3fbd150f0fa (patch)
tree58f8d2bc53df590b018692ef0bd22f633ffc50c2 /plugins/plugin_manager
parent71b77dfc7b95c24756bbb33a33d5fbcb27339168 (diff)
downloadlite-xl-plugin-manager-3aab9d2284e8c2a7f6ccb3fa767ec3fbd150f0fa.tar.gz
lite-xl-plugin-manager-3aab9d2284e8c2a7f6ccb3fa767ec3fbd150f0fa.zip
Added in plugin manager hook.
Diffstat (limited to 'plugins/plugin_manager')
-rw-r--r--plugins/plugin_manager/init.lua29
1 files changed, 28 insertions, 1 deletions
diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua
index 3c13feb..49aa1f9 100644
--- a/plugins/plugin_manager/init.lua
+++ b/plugins/plugin_manager/init.lua
@@ -27,7 +27,9 @@ config.plugins.plugin_manager = common.merge({
-- Whether or not to force install things.
force = false,
-- Dumps commands that run to stdout, as well as responses from lpm.
- debug = false
+ debug = false,
+ -- A list of addons to apply to the system bottle.
+ addons = nil
}, config.plugins.plugin_manager)
if not config.plugins.plugin_manager.lpm_binary_path then
@@ -149,6 +151,31 @@ local function run(cmd, progress)
return promise
end
+if config.plugins.plugin_manager.addons then
+ local addons = {}
+ for i,v in ipairs(config.plugins.plugin_manager.addons) do
+ if type(v) == 'table' then
+ local string = ""
+ if v.remote then
+ string = v.remote
+ if v.commit or v.branch then
+ string = string .. ":" .. (v.commit or v.branch)
+ end
+ string = string .. "@"
+ end
+ if not v.id then error("requires config.plugin_manager.addons entries to have an id") end
+ string = string .. v.id
+ if v.version then string = string .. ":" .. v.version end
+ table.insert(addons, string)
+ else
+ table.insert(addons, v)
+ end
+ end
+ run({ "apply", table.unpack(addons) }):done(function(status)
+ if status["changed"] then command.perform("core:restart") end
+ end)
+end
+
function PluginManager:refresh(options)
local prom = Promise.new()