Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Commit b07f6aa

Browse files
committed
feat: Pulling the commands into one with args to not pollute the global namespace
1 parent 281acbc commit b07f6aa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ lazy.nvim
4040

4141
## Commands
4242

43-
- `:BaredotInfo` - Print current status
44-
- `:BaredotToggle` - Manually toggle the env vars on / off
43+
- `:Baredot info` - Print current status
44+
- `:Baredot toggle` - Manually toggle the env vars on / off
4545

4646
## Functions
4747

lua/baredot/commands.lua

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,20 @@ end
3737
function Commands.setup(opt)
3838
options = opt
3939

40-
vim.api.nvim_create_user_command("BaredotInfo", Commands.info, { desc = "BaredotInfo" })
41-
vim.api.nvim_create_user_command("BaredotToggle", Commands.toggle, { desc = "BaredotToggle" })
40+
vim.api.nvim_create_user_command("Baredot", function(args)
41+
local cmd = vim.trim(args.args or "")
42+
if cmd == "toggle" then
43+
Commands.toggle()
44+
else
45+
Commands.info()
46+
end
47+
end, {
48+
desc = "Baredot",
49+
nargs = "?",
50+
complete = function()
51+
return { "info", "toggle" }
52+
end
53+
})
4254
end
4355

4456
return Commands

0 commit comments

Comments
 (0)