Fix back bootstrapping and healthcheck for fresh install with no packages to fetch.

This commit is contained in:
Ulibos 2023-04-27 04:01:10 +03:00
commit f03bf0a82b
3 changed files with 25 additions and 27 deletions

View file

@ -39,14 +39,11 @@ You can add the following Lua code to your `init.lua` to bootstrap **lazy.nvim**
```lua ```lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({ "git", "clone",
"git", "--filter=blob:none", "--depth=1",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release lazypath })
lazypath, vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
})
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
``` ```

View file

@ -53,19 +53,23 @@ function M.check()
end end
local spec = Config.spec local spec = Config.spec
for _, plugin in pairs(spec.plugins) do if spec == nil then
M.check_valid(plugin) ok("no packages setup for installation so far.")
M.check_override(plugin) else
end for _, plugin in pairs(spec.plugins) do
if #spec.notifs > 0 then M.check_valid(plugin)
error("Issues were reported when loading your specs:") M.check_override(plugin)
for _, notif in ipairs(spec.notifs) do end
local lines = vim.split(notif.msg, "\n") if #spec.notifs > 0 then
for _, line in ipairs(lines) do error("Issues were reported when loading your specs:")
if notif.level == vim.log.levels.ERROR then for _, notif in ipairs(spec.notifs) do
error(line) local lines = vim.split(notif.msg, "\n")
else for _, line in ipairs(lines) do
warn(line) if notif.level == vim.log.levels.ERROR then
error(line)
else
warn(line)
end
end end
end end
end end

View file

@ -96,14 +96,11 @@ end
function M.bootstrap() function M.bootstrap()
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({ "git", "clone",
"git", "--filter=blob:none", "--depth=1",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release lazypath })
lazypath, vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
})
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
end end