feat: add extra_args provider field
Problem: Overriding a single flag (e.g. `-outdir=build`) required redefining the entire `args` function, duplicating all preset defaults. Solution: Add `extra_args` field that appends to the resolved `args` after evaluation. Accepts a static table or a context function.
This commit is contained in:
parent
1fbc307bad
commit
7f1f8f8d65
2 changed files with 5 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
---@field ft? string
|
||||
---@field cmd string[]
|
||||
---@field args? string[]|fun(ctx: preview.Context): string[]
|
||||
---@field extra_args? string[]|fun(ctx: preview.Context): string[]
|
||||
---@field cwd? string|fun(ctx: preview.Context): string
|
||||
---@field env? table<string, string>
|
||||
---@field output? string|fun(ctx: preview.Context): string
|
||||
|
|
@ -94,6 +95,7 @@ function M.setup(opts)
|
|||
vim.validate(prefix .. '.cmd', provider.cmd, 'table')
|
||||
vim.validate(prefix .. '.cmd[1]', provider.cmd[1], 'string')
|
||||
vim.validate(prefix .. '.args', provider.args, { 'table', 'function' }, true)
|
||||
vim.validate(prefix .. '.extra_args', provider.extra_args, { 'table', 'function' }, true)
|
||||
vim.validate(prefix .. '.cwd', provider.cwd, { 'string', 'function' }, true)
|
||||
vim.validate(prefix .. '.output', provider.output, { 'string', 'function' }, true)
|
||||
vim.validate(prefix .. '.error_parser', provider.error_parser, 'function', true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue