mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
perf(git): display stderr on exit
This commit is contained in:
parent
f2f7c8dcc0
commit
9dda2491af
18
bundle/git.vim/lua/git/command/mv.lua
vendored
18
bundle/git.vim/lua/git/command/mv.lua
vendored
@ -3,13 +3,20 @@ local m = {}
|
||||
local job = require('spacevim.api.job')
|
||||
local nt = require('spacevim.api.notify')
|
||||
local log = require('git.log')
|
||||
local stddata = {}
|
||||
|
||||
local function on_exit(id, code, single)
|
||||
log.debug('git-mv exit code:' .. code .. ' single:' .. single)
|
||||
if code == 0 and single == 0 then
|
||||
nt.notify('git mv successfully')
|
||||
else
|
||||
nt.notify('failed to run git mv', 'warningmsg')
|
||||
nt.notify(table.concat(stddata, '\n'), 'warningmsg')
|
||||
end
|
||||
end
|
||||
|
||||
local function on_std(id, data)
|
||||
for _, v in ipairs(data) do
|
||||
table.insert(stddata, v)
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,13 +25,16 @@ function m.run(argv)
|
||||
if vim.fn.index(argv, '%') ~= -1 then
|
||||
argv[vim.fn.index(argv, '%') + 1] = vim.fn.expand('%')
|
||||
end
|
||||
for _, v in ipairs(argv) do table.insert(cmd, v)
|
||||
for _, v in ipairs(argv) do
|
||||
table.insert(cmd, v)
|
||||
end
|
||||
log.debug('git-mv cmd:' .. vim.inspect(cmd))
|
||||
stddata = {}
|
||||
job.start(cmd, {
|
||||
on_exit = on_exit
|
||||
on_exit = on_exit,
|
||||
on_stdout = on_std,
|
||||
on_stderr = on_std
|
||||
})
|
||||
end
|
||||
|
||||
return m
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user