refactor(health): move requires inside of function
This commit is contained in:
parent
125cac7058
commit
12d0885c0d
1 changed files with 8 additions and 7 deletions
|
|
@ -1,13 +1,11 @@
|
||||||
local health = vim.health or require "health"
|
|
||||||
local utils = require "gopher._utils._health"
|
|
||||||
local c = require("gopher.config").config.commands
|
local c = require("gopher.config").config.commands
|
||||||
|
|
||||||
local requried = "Gopher.nvim will not work without it!"
|
local requried_for_work_msg = "Gopher.nvim will not work without it!"
|
||||||
local M = {
|
local M = {
|
||||||
_required = {
|
_required = {
|
||||||
plugins = {
|
plugins = {
|
||||||
{ lib = "plenary", help = requried },
|
{ lib = "plenary", help = requried_for_work_msg },
|
||||||
{ lib = "nvim-treesitter", help = requried },
|
{ lib = "nvim-treesitter", help = requried_for_work_msg },
|
||||||
{ lib = "dap", help = "Required for set upping debugger" },
|
{ lib = "dap", help = "Required for set upping debugger" },
|
||||||
},
|
},
|
||||||
binarys = {
|
binarys = {
|
||||||
|
|
@ -21,9 +19,12 @@ local M = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.check()
|
function M.check()
|
||||||
|
local health = vim.health or require "health"
|
||||||
|
local u = require "gopher._utils._health"
|
||||||
|
|
||||||
health.report_start "Required plugins"
|
health.report_start "Required plugins"
|
||||||
for _, plugin in ipairs(M._required.plugins) do
|
for _, plugin in ipairs(M._required.plugins) do
|
||||||
if utils.lualib_is_found(plugin.lib) then
|
if u.lualib_is_found(plugin.lib) then
|
||||||
health.report_ok(plugin.lib .. " installed.")
|
health.report_ok(plugin.lib .. " installed.")
|
||||||
else
|
else
|
||||||
health.report_error(plugin.lib .. " not found. " .. plugin.help)
|
health.report_error(plugin.lib .. " not found. " .. plugin.help)
|
||||||
|
|
@ -32,7 +33,7 @@ function M.check()
|
||||||
|
|
||||||
health.report_start "Required go tools"
|
health.report_start "Required go tools"
|
||||||
for _, binary in ipairs(M._required.binarys) do
|
for _, binary in ipairs(M._required.binarys) do
|
||||||
if utils.binary_is_found(binary.bin) then
|
if u.binary_is_found(binary.bin) then
|
||||||
health.report_ok(binary.bin .. " installed")
|
health.report_ok(binary.bin .. " installed")
|
||||||
else
|
else
|
||||||
health.report_warn(binary.bin .. " is not installed but " .. binary.help)
|
health.report_warn(binary.bin .. " is not installed but " .. binary.help)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue