From de6cc1a30ac0155e84407f7530d378e04bb7497f Mon Sep 17 00:00:00 2001 From: Jakob Beckmann Date: Wed, 29 Jul 2026 09:18:52 +0200 Subject: [PATCH 1/2] feat(api): expose some APIs to control executor programmatically Signed-off-by: Jakob Beckmann --- README.md | 4 ++++ lua/executor/init.lua | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 447cebf..3a91773 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,10 @@ executor.commands.run_with_new_command() executor.commands.show_presets() executor.commands.show_history() executor.commands.run_one_off(cmd) + +-- some minimal API which does not trigger user interactions +executor.api.set_task_command(cmd) +executor.api.run_task(cmd?) ``` You can therefore map the Vim commands to a key: diff --git a/lua/executor/init.lua b/lua/executor/init.lua index f6349a7..f8866ea 100644 --- a/lua/executor/init.lua +++ b/lua/executor/init.lua @@ -97,6 +97,11 @@ Public.commands = { end, } +Public.api = { + set_task_command = Executor.set_task_command, + run_task = Executor.run_task, +} + vim.api.nvim_create_user_command("ExecutorReset", function() Public.commands.reset() end, {}) From 1fff91b2b497477752b846bedba2e49a9a442819 Mon Sep 17 00:00:00 2001 From: Jakob Beckmann Date: Wed, 26 Aug 2026 07:02:26 +0200 Subject: [PATCH 2/2] feat(api): make api.run_task throw if no command stored or provided Signed-off-by: Jakob Beckmann --- lua/executor/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/executor/init.lua b/lua/executor/init.lua index f8866ea..c7f7b3c 100644 --- a/lua/executor/init.lua +++ b/lua/executor/init.lua @@ -99,7 +99,12 @@ Public.commands = { Public.api = { set_task_command = Executor.set_task_command, - run_task = Executor.run_task, + run_task = function(cmd) + if not cmd and not Executor._stored_task_command then + error("no command provided as argument and no stored task command found for api.run_task") + end + Executor.run_task(cmd) + end, } vim.api.nvim_create_user_command("ExecutorReset", function()