fix(iferr): now this not have type errors

This commit is contained in:
Smirnov Oleksandr 2023-02-07 21:42:56 +02:00
parent 674320821f
commit d91bae8864

View file

@ -1,16 +1,15 @@
local c = require("gopher.config").config.commands
---Add iferr declaration
---That's Lua of vimscript implementation of:
---github.com/koron/iferr
return function()
local c = require("gopher.config").config.commands
local u = require "gopher._utils"
local boff = vim.fn.wordcount().cursor_bytes
local cmd = (c.iferr .. " -pos " .. boff)
local data = vim.fn.systemlist(cmd, vim.fn.bufnr "%")
local data = vim.fn.systemlist(cmd, vim.fn.bufnr(0)) --[[@as string]]
if vim.v.shell_error ~= 0 then
u.notify("command " .. cmd .. " exited with code " .. vim.v.shell_error, "error")
error("iferr exited with code: " .. vim.v.shell_error)
return
end