From 398e1799e8fbcaae11d2ff9a084a94cbb26a4ff6 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 29 Sep 2022 21:31:25 -0400 Subject: Attempting to fix.. --- README.md | 2 ++ lpm.lua | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5a947b4..bd08067 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ If you want to build it quickly, and have the right modules installed, you can d CI is enabled on this repository, so you can grab Windows and Linux builds from the `continuous` [release page](https://github.com/adamharrison/lite-xl-plugin-manager/releases/tag/continuous). +You can get a feel for how to use `lpm` by typing `./lpm --help`. + ## Use in CI To make pre-fab lite builds, you can easily use `lpm` in CI. If you had a linux build container, you could do something like: diff --git a/lpm.lua b/lpm.lua index 80ec805..734eb48 100644 --- a/lpm.lua +++ b/lpm.lua @@ -356,6 +356,25 @@ end local common = {} + +function common.split(splitter, str) + local o = 1 + local res = {} + while true do + local s, e = str:find(splitter, o) + table.insert(res, str:sub(o, s and (s - 1) or #str)) + if not s then break end + o = e + 1 + end + return table.unpack(res) +end + +function common.dirname(path) + local s = path:reverse():find(PATHSEP) + if not s then return path end + return path:sub(1, #path - s) +end + function common.rmrf(root) if not root or root == "" then return end local info = system.stat(root) @@ -369,9 +388,9 @@ function common.mkdirp(path) local stat = system.stat(path) if stat and stat.type == "dir" then return true end if stat and stat.type == "file" then error("path " .. path .. " exists") end + system.mkdir(path) local subdirs = {} while path and path ~= "" do - system.mkdir(path) local updir, basedir = path:match("(.*)[/\\](.+)$") table.insert(subdirs, 1, basedir or path) path = updir @@ -390,12 +409,6 @@ function common.basename(path) end -function common.dirname(path) - local s = path:reverse():find(PATHSEP) - if not s then return path end - return path:sub(1, #path - s) -end - function common.merge(src, merge) for k, v in pairs(merge) do src[k] = v end @@ -1241,9 +1254,9 @@ local function lpm_plugin_uninstall(...) for i, name in ipairs({ ... }) do local plugins = { get_plugin(name) } if #plugins == 0 then error("can't find plugin " .. name) end - local installed_plugins = common.grep(plugins, function(plugin) return plugin:is_installed() end) + local installed_plugins = common.grep(plugins, function(plugin) return plugin:is_installed(system_bottle) end) if #installed_plugins == 0 then error("plugin " .. name .. " not installed") end - for i, plugin in ipairs(installed_plugins) do plugin:uninstall() end + for i, plugin in ipairs(installed_plugins) do plugin:uninstall(system_bottle) end end end -- cgit v1.2.3