Skip to content

Commit

Permalink
feat: add config option to disable autostart when loading tasks (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jan 6, 2024
1 parent 78e8933 commit de07357
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lua/overseer/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ local default_config = {
save_task_opts = {
bundleable = true,
},
-- Autostart tasks when they are loaded from a bundle
autostart_on_load = true,
},
-- A list of components to preload on setup.
-- Only matters if you want them to show up in the task editor.
Expand Down
4 changes: 2 additions & 2 deletions lua/overseer/task_bundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ end
---@param name nil|string
---@param opts nil|table
--- ignore_missing nil|boolean When true, don't notify if bundle doesn't exist
--- autostart nil|boolean When true, start the tasks after loading (default true)
--- autostart nil|boolean When true, start the tasks after loading (default to config.bundles.autostart_on_load)
M.load_task_bundle = function(name, opts)
vim.validate({
name = { name, "s", true },
opts = { opts, "t", true },
})
opts = vim.tbl_deep_extend("keep", opts or {}, {
autostart = true,
autostart = config.bundles.autostart_on_load,
})
if name then
local filepath = files.join(get_bundle_dir(), string.format("%s.bundle.json", name))
Expand Down
5 changes: 4 additions & 1 deletion lua/resession/extensions/overseer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ end

M.on_load = function(data)
local overseer = require("overseer")
local config = require("overseer.config")
for _, params in ipairs(data) do
local task = overseer.new_task(params)
task:start()
if config.bundles.autostart_on_load then
task:start()
end
end
end

Expand Down

0 comments on commit de07357

Please sign in to comment.