test: clear(): remove opts.headless parameter

Callers can instead specify `args_rm={'--headless'}`.

TODO: should `nvim_argv` have "--headless" by default? Need to inspect
      some uses of spawn(nvim_argv) ...
This commit is contained in:
Justin M. Keyes
2019-04-17 01:38:59 +02:00
parent 17291642bd
commit 698c4f662d
5 changed files with 6 additions and 12 deletions

View File

@@ -394,17 +394,16 @@ end
-- removed, e.g. args_rm={'--cmd'} removes all cases of "--cmd"
-- (and its value) from the default set.
-- env: Map: Defines the environment of the new session.
-- headless: Boolean (default=true): Append --headless arg.
--
-- Example:
-- clear('-e')
-- clear{args={'-e'}, args_rm={'-i'}, env={TERM=term}}
local function clear(...)
local args = {unpack(nvim_argv)}
table.insert(args, '--headless')
local new_args
local env = nil
local opts = select(1, ...)
local headless = true
if type(opts) == 'table' then
args = remove_args(args, opts.args_rm)
if opts.env then
@@ -432,15 +431,9 @@ local function clear(...)
end
end
new_args = opts.args or {}
if opts.headless == false then
headless = false
end
else
new_args = {...}
end
if headless then
table.insert(args, '--headless')
end
for _, arg in ipairs(new_args) do
table.insert(args, arg)
end