Skip to content

Commit 59ea59e

Browse files
authored
feat(slash_cmds): can be functions and modules (#844)
Co-authored-by: Oli Morris <olimorris@users.noreply.github.com>
1 parent f1840a1 commit 59ea59e

File tree

1 file changed

+5
-0
lines changed
  • lua/codecompanion/strategies/chat/slash_commands

1 file changed

+5
-0
lines changed

lua/codecompanion/strategies/chat/slash_commands/init.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ function SlashCommands:execute(item, chat)
5656
local label = item.label:sub(1)
5757
log:debug("Executing slash command: %s", label)
5858

59+
-- If the user has provided a callback function, use that
60+
if type(item.config.callback) == "function" then
61+
return item.config.callback(chat)
62+
end
63+
5964
local callback = resolve(item.config.callback)
6065
if not callback then
6166
return log:error("Slash command not found: %s", label)

0 commit comments

Comments
 (0)