feat: implement public API and plugin commands

Rewrite init.lua to expose setup(), run(), stop(), and toggle() that
coordinate across config, runner, window, and indicator modules. Replace
the placeholder SayHello command in plugin/watchexec.lua with keymaps
(<Leader>wx{t,s,r}), :WatchexecRun/:WatchexecStop/:WatchexecToggle
commands, VimLeavePre cleanup, and VimResized auto-resize.
This commit is contained in:
Stevan Freeborn
2026-07-06 19:51:37 -05:00
parent 398d3dd585
commit 1c46c3fcd9
5 changed files with 417 additions and 22 deletions
+25 -11
View File
@@ -1,17 +1,31 @@
local plugin = require("watchexec")
describe("watchexec logic", function()
before_each(function()
plugin.setup({
greeting = "Hello Test!",
})
end)
local watchexec = require("watchexec")
describe("watchexec module", function()
it("can be required without errors", function()
assert.not_nil(plugin)
assert.not_nil(watchexec)
end)
it("correctly applies user configuration", function()
assert.equals("Hello Test!", plugin.config.greeting)
it("exposes setup function", function()
assert.is_function(watchexec.setup)
end)
it("exposes run function", function()
assert.is_function(watchexec.run)
end)
it("exposes stop function", function()
assert.is_function(watchexec.stop)
end)
it("exposes toggle function", function()
assert.is_function(watchexec.toggle)
end)
it("setup delegates to config", function()
local config = require("watchexec.config")
watchexec.setup({ auto_scroll = false })
assert.equals(false, config.get().auto_scroll)
end)
end)