1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

fix(pastebin): change url on stdout

This commit is contained in:
wsdjeg 2023-07-14 11:54:19 +08:00
parent 4a8a6f76f0
commit 0cb4dc5b06

View File

@ -66,19 +66,22 @@ local function get_visual_selection()
return table.concat(lines, '\n')
end
local function on_stdout(id, data)
local function on_stdout(_, data)
for _, v in ipairs(data) do
log.info(v)
if #v > 0 then
url = v
end
end
end
local function on_stderr(id, data)
local function on_stderr(_, data)
for _, v in ipairs(data) do
log.warn(v)
end
end
local function on_exit(id, code, single)
local function on_exit(_, code, single)
job_id = -1
if code == 0 and single == 0 and url ~= '' then
vim.fn.setreg('+', url .. '.txt')