diff options
author | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-24 04:06:35 +0300 |
---|---|---|
committer | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-24 04:06:35 +0300 |
commit | 0703f679c83da5254f50b1e78af1220a3a6882a4 (patch) | |
tree | d56bb692b3a2652cc1e727872d3f7f496051aa8c /lua/cmake/terminal.lua | |
parent | f9b36bf730fda5488be87b91fd03a6f7cbf64e73 (diff) |
fix: properly run last executable
Diffstat (limited to 'lua/cmake/terminal.lua')
-rw-r--r-- | lua/cmake/terminal.lua | 20 |
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 |