aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-12-08 02:13:17 +0100
committerGitHub <noreply@github.com>2022-12-08 02:13:17 +0100
commitf0a71b423991ea5589c389381ab8e022c5ef5f29 (patch)
tree6c8a4b1e37bc756c03e3468a964cfaa99ae1884e /lua
parenttest(functional): add some tests (#742) (diff)
downloadmason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar.gz
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar.bz2
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar.lz
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar.xz
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.tar.zst
mason-f0a71b423991ea5589c389381ab8e022c5ef5f29.zip
feat(platform): accept darwin (#743)
Mac systems are generally referred to as the Darwin OS. For all intents and purposes, "mac" and "darwin" can be used interchangeably (although darwin will be preferred going forward).
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/platform.lua12
-rw-r--r--lua/mason-core/terminator.lua2
2 files changed, 8 insertions, 6 deletions
diff --git a/lua/mason-core/platform.lua b/lua/mason-core/platform.lua
index 31a1522e..0a7a3e33 100644
--- a/lua/mason-core/platform.lua
+++ b/lua/mason-core/platform.lua
@@ -9,6 +9,7 @@ local uname = vim.loop.os_uname()
---| '"unix"'
---| '"linux"'
---| '"mac"'
+---| '"darwin"'
local arch_aliases = {
["x86_64"] = "x64",
@@ -59,6 +60,7 @@ local cached_features = {
["win32"] = vim.fn.has "win32",
["win64"] = vim.fn.has "win64",
["mac"] = vim.fn.has "mac",
+ ["darwin"] = vim.fn.has "mac",
["unix"] = vim.fn.has "unix",
["linux"] = vim.fn.has "linux",
}
@@ -83,7 +85,7 @@ local check_env = _.memoize(_.cond {
---Table that allows for checking whether the provided targets apply to the current system.
---Each key is a target tuple consisting of at most 3 targets, in the following order:
---- 1) OS (e.g. linux, unix, mac, win) - Mandatory
+--- 1) OS (e.g. linux, unix, darwin, win) - Mandatory
--- 2) Architecture (e.g. arm64, x64) - Optional
--- 3) Environment (e.g. gnu, musl, openbsd) - Optional
---Each target is separated by a "_" character, like so: "linux_x64_musl".
@@ -108,8 +110,8 @@ M.is = setmetatable({}, {
---@param platform_table table<Platform, T>
---@return T
local function get_by_platform(platform_table)
- if M.is.mac then
- return platform_table.mac or platform_table.unix
+ if M.is.darwin then
+ return platform_table.darwin or platform_table.mac or platform_table.unix
elseif M.is.linux then
return platform_table.linux or platform_table.unix
elseif M.is.unix then
@@ -180,7 +182,7 @@ M.os_distribution = _.lazy(function()
end)
:get_or_throw()
end,
- mac = function()
+ darwin = function()
return { id = "macOS", version = {} }
end,
win = function()
@@ -191,7 +193,7 @@ end)
---@type async fun(): Result<string>
M.get_homebrew_prefix = _.lazy(function()
- assert(M.is.mac, "Can only locate Homebrew installation on Mac systems.")
+ assert(M.is.darwin, "Can only locate Homebrew installation on Mac systems.")
local spawn = require "mason-core.spawn"
return spawn
.brew({ "--prefix" })
diff --git a/lua/mason-core/terminator.lua b/lua/mason-core/terminator.lua
index b7acefe8..f855834a 100644
--- a/lua/mason-core/terminator.lua
+++ b/lua/mason-core/terminator.lua
@@ -55,7 +55,7 @@ end
local active_handles = {}
----@parma handle InstallHandle
+---@param handle InstallHandle
function M.register(handle)
if handle:is_closed() then
return