From f25f942eb76f485d09f770dd5ea4c4ca3bef4e0b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 18 Dec 2022 11:42:27 +0100 Subject: [PATCH] feat: expose all commands on main lazy module --- lua/lazy/init.lua | 7 +++++++ lua/lazy/view/commands.lua | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/lazy/init.lua b/lua/lazy/init.lua index 4476603..6b316cd 100644 --- a/lua/lazy/init.lua +++ b/lua/lazy/init.lua @@ -1,3 +1,4 @@ +---@type LazyCommands local M = {} ---@param spec LazySpec Should be a module name to load, or a plugin spec @@ -87,4 +88,10 @@ function M.plugins() return vim.tbl_values(require("lazy.core.config").plugins) end +setmetatable(M, { + __index = function(_, key) + return require("lazy.view.commands").commands[key] + end, +}) + return M diff --git a/lua/lazy/view/commands.lua b/lua/lazy/view/commands.lua index 7cd0e0b..241eca5 100644 --- a/lua/lazy/view/commands.lua +++ b/lua/lazy/view/commands.lua @@ -16,6 +16,7 @@ function M.cmd(cmd, plugins) end end +---@class LazyCommands M.commands = { clean = function(plugins) Manage.clean({ clear = true, mode = "clean", plugins = plugins }) @@ -33,6 +34,9 @@ M.commands = { home = function() View.show("home") end, + show = function() + View.show("home") + end, help = function() View.show("help") end, @@ -44,8 +48,8 @@ M.commands = { end, sync = function() Manage.clean({ clear = true, wait = true, mode = "sync" }) - Manage.update({ interactive = true }) - Manage.install({ interactive = true }) + Manage.update() + Manage.install() end, update = function(plugins) Manage.update({ clear = true, mode = "update", plugins = plugins })