aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer/managers
diff options
context:
space:
mode:
Diffstat (limited to 'lua/mason-core/installer/managers')
-rw-r--r--lua/mason-core/installer/managers/gem.lua6
-rw-r--r--lua/mason-core/installer/managers/npm.lua8
-rw-r--r--lua/mason-core/installer/managers/pypi.lua13
3 files changed, 24 insertions, 3 deletions
diff --git a/lua/mason-core/installer/managers/gem.lua b/lua/mason-core/installer/managers/gem.lua
index cb502de5..e8723d7e 100644
--- a/lua/mason-core/installer/managers/gem.lua
+++ b/lua/mason-core/installer/managers/gem.lua
@@ -54,14 +54,14 @@ function M.create_bin_wrapper(bin)
ctx.write_shell_exec_wrapper,
ctx,
bin,
- path.concat { ctx.package:get_install_path(), bin_path },
+ path.concat { ctx:get_install_path(), bin_path },
{
GEM_PATH = platform.when {
unix = function()
- return ("%s:$GEM_PATH"):format(ctx.package:get_install_path())
+ return ("%s:$GEM_PATH"):format(ctx:get_install_path())
end,
win = function()
- return ("%s;%%GEM_PATH%%"):format(ctx.package:get_install_path())
+ return ("%s;%%GEM_PATH%%"):format(ctx:get_install_path())
end,
},
}
diff --git a/lua/mason-core/installer/managers/npm.lua b/lua/mason-core/installer/managers/npm.lua
index 10a3e9fd..df8ece35 100644
--- a/lua/mason-core/installer/managers/npm.lua
+++ b/lua/mason-core/installer/managers/npm.lua
@@ -70,6 +70,14 @@ function M.install(pkg, version, opts)
}
end
+---@async
+---@param pkg string
+function M.uninstall(pkg)
+ local ctx = installer.context()
+ ctx.stdio_sink.stdout(("Uninstalling npm package %s…\n"):format(pkg))
+ return ctx.spawn.npm { "uninstall", pkg }
+end
+
---@param exec string
function M.bin_path(exec)
return Result.pcall(platform.when, {
diff --git a/lua/mason-core/installer/managers/pypi.lua b/lua/mason-core/installer/managers/pypi.lua
index c569e0fd..85fadc9f 100644
--- a/lua/mason-core/installer/managers/pypi.lua
+++ b/lua/mason-core/installer/managers/pypi.lua
@@ -214,6 +214,19 @@ function M.install(pkg, version, opts)
}, opts.install_extra_args)
end
+---@async
+---@param pkg string
+function M.uninstall(pkg)
+ log.fmt_debug("pypi: uninstall %s", pkg)
+ return venv_python {
+ "-m",
+ "pip",
+ "uninstall",
+ "-y",
+ pkg,
+ }
+end
+
---@param executable string
function M.bin_path(executable)
local ctx = installer.context()