From 1fc5368cb7a7f19e459803f6bd41084be48ca7ec Mon Sep 17 00:00:00 2001 From: rootiest Date: Sat, 23 Nov 2024 14:22:35 -0500 Subject: [PATCH] feat: add function to retrieve system architecture --- lua/data/func.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/data/func.lua b/lua/data/func.lua index d88183b..9b556f2 100644 --- a/lua/data/func.lua +++ b/lua/data/func.lua @@ -2434,5 +2434,23 @@ function M.help_lookup_quoted_visual() M.help_lookup_string(M.wrap_in_quotes(selected_text)) end +function M.get_system_arch() + -- Use jit.arch if available + if jit and jit.arch then + return jit.arch + end + + -- Fallback to `uname -m` + local handle = io.popen('uname -m') + if handle then + local result = handle:read('*a'):gsub('%s+', '') + handle:close() + return result + end + + -- If all else fails + return 'unknown' +end + -- Export the module return M