feat(iferr): add -message support (#89)
* feat(iferr): add *-message* support * generate docs
This commit is contained in:
parent
bb31271311
commit
d1a21bffab
6 changed files with 48 additions and 1 deletions
|
|
@ -66,6 +66,11 @@ local default_config = {
|
|||
-- default tags to add to struct fields
|
||||
default_tag = "json",
|
||||
},
|
||||
iferr = {
|
||||
-- choose a custom error message
|
||||
---@type string|nil
|
||||
message = nil,
|
||||
},
|
||||
}
|
||||
--minidoc_afterlines_end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,13 @@ function iferr.iferr()
|
|||
local pos = vim.fn.getcurpos()[2]
|
||||
local fpath = vim.fn.expand "%"
|
||||
|
||||
local rs = r.sync({ c.commands.iferr, "-pos", curb }, {
|
||||
local cmd = { c.commands.iferr, "-pos", curb }
|
||||
if c.iferr.message ~= nil and type(c.iferr.message) == "string" then
|
||||
table.insert(cmd, "-message")
|
||||
table.insert(cmd, c.iferr.message)
|
||||
end
|
||||
|
||||
local rs = r.sync(cmd, {
|
||||
stdin = u.readfile_joined(fpath),
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue