diff --git a/lua/gopher/_utils/runner/init.lua b/lua/gopher/_utils/runner/init.lua index 809899d..f4824c8 100644 --- a/lua/gopher/_utils/runner/init.lua +++ b/lua/gopher/_utils/runner/init.lua @@ -1,9 +1,11 @@ +local c = require "gopher.config" local runner = {} ---@class gopher.RunnerOpts ---@field cwd? string ---@field timeout? number ----@field stdin? string|string[] +---@field stdin? boolean|string|string[] +---@field text? boolean ---@param cmd (string|number)[] ---@param opts? gopher.RunnerOpts @@ -14,9 +16,9 @@ function runner.sync(cmd, opts) return vim .system(cmd, { cwd = opts.cwd or nil, - timeout = opts.timeout or 2000, -- TODO: move out to config + timeout = opts.timeout or c.timeout, stdin = opts.stdin or nil, - text = true, + text = opts.text or true, }) :wait() end @@ -29,8 +31,9 @@ function runner.async(cmd, on_exit, opts) opts = opts or {} return vim.system(cmd, { cwd = opts.cwd or nil, - timeout = opts.timeout or 2000, - text = true, + timeout = opts.timeout or c.timeout, + stdin = opts.stdin or nil, + text = opts.text or true, }, on_exit) end diff --git a/lua/gopher/config.lua b/lua/gopher/config.lua index 18c08c3..94dbab9 100644 --- a/lua/gopher/config.lua +++ b/lua/gopher/config.lua @@ -33,6 +33,10 @@ local default_config = { ---@type number log_level = vim.log.levels.INFO, + -- timeout for running commands + ---@type number + timeout = 2000, + -- user specified paths to binaries ---@class gopher.ConfigCommand commands = {