aboutsummaryrefslogtreecommitdiff
path: root/plugins/plugin_manager/init.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-02-04 15:36:01 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-02-04 15:36:01 -0500
commit5c61eb11703b92270592507b6fd3ae27ae6f76a5 (patch)
tree9c38068495c894795854fdc845fd64d68dcf86cc /plugins/plugin_manager/init.lua
parent52fbb4b6985e9dee33387c67727437910d0b8d0b (diff)
downloadlite-xl-plugin-manager-5c61eb11703b92270592507b6fd3ae27ae6f76a5.tar.gz
lite-xl-plugin-manager-5c61eb11703b92270592507b6fd3ae27ae6f76a5.zip
Added in refresh and upgrade commands.
Diffstat (limited to 'plugins/plugin_manager/init.lua')
-rw-r--r--plugins/plugin_manager/init.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/plugin_manager/init.lua b/plugins/plugin_manager/init.lua
index eea9efb..9dee036 100644
--- a/plugins/plugin_manager/init.lua
+++ b/plugins/plugin_manager/init.lua
@@ -21,7 +21,7 @@ config.plugins.plugin_manager = common.merge({
cachdir = USERDIR .. PATHSEP .. "lpm",
-- Path to the folder that holds user-specified plugins.
userdir = USERDIR,
- -- Path to ssl certificate directory.
+ -- Path to ssl certificate directory or bunde. Nil will auto-detect.
ssl_certs = nil,
-- Whether or not to force install things.
force = false,
@@ -165,6 +165,17 @@ function PluginManager:refresh(progress)
end
+function PluginManager:upgrade(progress)
+ local prom = Promise.new()
+ run({ "update" }, progress):done(function()
+ run({ "upgrade" }, progress):done(function()
+ prom:resolve()
+ end)
+ end)
+ return prom
+end
+
+
function PluginManager:get_addons()
local prom = Promise.new()
if self.addons then
@@ -227,7 +238,7 @@ command.add(nil, {
function(name)
PluginManager:get_addon(name):done(function(addon)
core.log("Attempting to install plugin " .. name .. "...")
- PluginManager:install(addon):done(function()
+ PluginManager:install(addon, PluginManager.view.progress_callback):done(function()
core.log("Successfully installed plugin " .. addon.id .. ".")
end)
end):fail(function()
@@ -252,7 +263,7 @@ command.add(nil, {
function(name)
PluginManager:get_addon(name):done(function(addon)
core.log("Attempting to uninstall plugin " .. addon.id .. "...")
- PluginManager:install(addon):done(function()
+ PluginManager:uninstall(addon, PluginManager.view.progress_callback):done(function()
core.log("Successfully uninstalled plugin " .. addon.id .. ".")
end)
end):fail(function()
@@ -299,7 +310,8 @@ command.add(nil, {
end
)
end,
- ["plugin-manager:refresh"] = function() PluginManager:refresh():done(function() core.log("Successfully refreshed plugin listing.") end) end,
+ ["plugin-manager:refresh"] = function() PluginManager:refresh(PluginManager.view.progress_callback):done(function() core.log("Successfully refreshed plugin listing.") end) end,
+ ["plugin-manager:upgrade"] = function() PluginManager:upgrade(PluginManager.view.progress_callback):done(function() core.log("Successfully upgraded installed plugins.") end) end,
["plugin-manager:show"] = function()
local node = core.root_view:get_active_node_default()
node:add_view(PluginManager.view(PluginManager))