From d452fe37f0399fb11f1020d4bd3377afc7b5a1c8 Mon Sep 17 00:00:00 2001 From: Peppe Date: Tue, 2 Jul 2024 12:08:40 -0300 Subject: [PATCH 1/2] (chore): updated health.lua to use the new 0.11 api. (#2) --- lua/zellij-nav/health.lua | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/lua/zellij-nav/health.lua b/lua/zellij-nav/health.lua index cf70c1f..9a2f408 100644 --- a/lua/zellij-nav/health.lua +++ b/lua/zellij-nav/health.lua @@ -1,13 +1,33 @@ local M = {} + +M._check = function() + vim.health.start("zellij-nav.nvim") + local version = vim.fn.system("zellij --version") + if vim.v.shell_error ~= 0 then + vim.health.error("zellij executable not found in user's path") + else + vim.health.ok("found zellij version " .. string.gsub(version, "zellij ", "")) + end +end + +M.deprecated_check = function() + vim.health.report_start("zellij-nav.nvim") + local version = vim.fn.system("zellij --version") + if vim.v.shell_error ~= 0 then + vim.health.report_error("zellij executable not found in user's path") + else + vim.health.report_ok("found zellij version " .. string.gsub(version, "zellij ", "")) + end +end + M.check = function() - vim.health.report_start("zellij-nav.nvim") - local version = vim.fn.system("zellij --version") - if vim.v.shell_error ~= 0 then - vim.health.report_error("zellij executable not found in user's path") - else - vim.health.report_ok("found zellij version " .. string.gsub(version, "zellij ", "")) - end + local vim_version = vim.version() + if vim_version.minor > 10 then + M._check() + else + M.deprecated_check() + end end return M From 2e6cbe6ab11c76c4a01f3ace15b88bc0c904d13d Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 3 Sep 2024 14:19:45 -0600 Subject: [PATCH 2/2] chore: update healthcheck for new API --- lua/zellij-nav/health.lua | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/lua/zellij-nav/health.lua b/lua/zellij-nav/health.lua index 9a2f408..9b6ed5b 100644 --- a/lua/zellij-nav/health.lua +++ b/lua/zellij-nav/health.lua @@ -1,33 +1,17 @@ local M = {} - -M._check = function() - vim.health.start("zellij-nav.nvim") - local version = vim.fn.system("zellij --version") - if vim.v.shell_error ~= 0 then - vim.health.error("zellij executable not found in user's path") - else - vim.health.ok("found zellij version " .. string.gsub(version, "zellij ", "")) - end -end - -M.deprecated_check = function() - vim.health.report_start("zellij-nav.nvim") - local version = vim.fn.system("zellij --version") - if vim.v.shell_error ~= 0 then - vim.health.report_error("zellij executable not found in user's path") - else - vim.health.report_ok("found zellij version " .. string.gsub(version, "zellij ", "")) - end -end - M.check = function() - local vim_version = vim.version() - if vim_version.minor > 10 then - M._check() - else - M.deprecated_check() - end + local start = vim.health.report_start or vim.health.start + local report_ok = vim.health.report_ok or vim.health.ok + local report_error = vim.health.report_error or vim.health.error + + start("zellij-nav.nvim") + local version = vim.fn.system("zellij --version") + if vim.v.shell_error ~= 0 then + report_error("zellij executable not found in user's path") + else + report_ok("found zellij version " .. string.gsub(version, "zellij ", "")) + end end return M