fix(utils): missing functions (fixes #257) (#259)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham 2024-08-27 02:13:56 -04:00 committed by GitHub
parent ad5b61bf6a
commit 6d52db4fa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,25 @@ M.has = function(plugin)
return package.loaded[plugin] ~= nil return package.loaded[plugin] ~= nil
end end
---@return "linux" | "darwin" | "windows"
M.get_os_name = function()
local os_name = vim.uv.os_uname().sysname
if os_name == "Linux" then
return "linux"
elseif os_name == "Darwin" then
return "darwin"
elseif os_name == "Windows_NT" then
return "windows"
else
error("Unsupported operating system: " .. os_name)
end
end
---@param input_cmd string
M.shell_run = function(input_cmd)
local output = vim.system(vim.split(cmd, " ", { trimempty = true }), { text = true })
end
---@alias _ToggleSet fun(state: boolean): nil ---@alias _ToggleSet fun(state: boolean): nil
---@alias _ToggleGet fun(): boolean ---@alias _ToggleGet fun(): boolean
--- ---