aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake/terminal.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/cmake/terminal.lua')
-rw-r--r--lua/cmake/terminal.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/lua/cmake/terminal.lua b/lua/cmake/terminal.lua
index 9581297..e086644 100644
--- a/lua/cmake/terminal.lua
+++ b/lua/cmake/terminal.lua
@@ -61,7 +61,11 @@ M.cmake_execute = function(command, opts)
end
M.cmake_toggle = function()
- cmake:toggle()
+ if cmake then
+ cmake:toggle()
+ else
+ vim.notify("No CMake terminal")
+ end
end
M.target_execute = function(command, opts)
@@ -75,16 +79,16 @@ M.target_execute = function(command, opts)
if not runnable then
runnable = Terminal:new(term_opts)
end
- local cd = "cd " .. command.cwd
- local cmd = "./" .. command.cmd
- vim.notify(cd)
- vim.notify(cmd)
-
if not runnable:is_open() then
runnable:open()
end
- runnable:send(cd)
- runnable:send(cmd)
+ vim.notify(vim.inspect(command), vim.log.levels.INFO)
+ if command.cd then
+ runnable:send("cd " .. command.cd)
+ end
+ if command.cmd then
+ runnable:send(command.cmd)
+ end
end
return M