Skip to content

Commit

Permalink
feat: better defaults for overseer
Browse files Browse the repository at this point in the history
  • Loading branch information
Civitasv committed Dec 20, 2023
1 parent ceb3360 commit cb7dc21
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ require("cmake-tools").setup {
console = "integratedTerminal",
},
cmake_executor = { -- executor to use
name = "quickfix", -- name of the executor
name = "overseer", -- name of the executor
opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for executors
quickfix = {
Expand All @@ -60,8 +60,19 @@ require("cmake-tools").setup {
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success"
}
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task)
require("overseer").open(
{ enter = false, direction = "right" }
)
end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = "Main Terminal",
Expand Down Expand Up @@ -93,8 +104,16 @@ require("cmake-tools").setup {
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success"
}
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task)
end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = "Main Terminal",
Expand Down
18 changes: 16 additions & 2 deletions lua/cmake-tools/const.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ local const = {
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success",
},
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
Expand Down Expand Up @@ -65,7 +72,14 @@ local const = {
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
new_task_opts = {
strategy = {
"toggleterm",
direction = "horizontal",
autos_croll = true,
quit_on_exit = "success",
},
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
Expand Down
5 changes: 2 additions & 3 deletions lua/cmake-tools/overseer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ function _overseer.close(opts)
end

function _overseer.run(cmd, env_script, env, args, cwd, opts, on_exit, on_output)
_overseer.show(opts)
opts = vim.tbl_extend("keep", {
local new_task_opts = vim.tbl_extend("keep", {
-- cmd = env_script .. " && " .. cmd, -- Temporarily disabling envScript for Overseer: Refer #158 and #159 for more details
cmd = cmd,
args = args,
env = env,
cwd = cwd,
}, opts.new_task_opts)
_overseer.job = overseer.new_task(opts)
_overseer.job = overseer.new_task(new_task_opts)
if on_exit ~= nil then
_overseer.job:subscribe("on_exit", function(out)
on_exit(out.exit_code)
Expand Down

0 comments on commit cb7dc21

Please sign in to comment.