mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 00:10:07 +08:00
fix(git): make error message clear
This commit is contained in:
parent
870f8fee96
commit
b33626c63b
@ -3,10 +3,18 @@ local M = {}
|
|||||||
local log = require('git.log')
|
local log = require('git.log')
|
||||||
|
|
||||||
function M.run(command, ...)
|
function M.run(command, ...)
|
||||||
local argv = {...}
|
local argv = { ... }
|
||||||
local ok, cmd = pcall(require, 'git.command.' .. command)
|
local ok, cmd = pcall(require, 'git.command.' .. command)
|
||||||
if ok and type(cmd.run) == "function" then
|
if ok then
|
||||||
cmd.run(argv)
|
if type(cmd.run) == 'function' then
|
||||||
|
cmd.run(argv)
|
||||||
|
else
|
||||||
|
vim.api.nvim_echo(
|
||||||
|
{ { 'git.command.' .. command .. '.run is not function', 'WarningMsg' } },
|
||||||
|
false,
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error(cmd)
|
error(cmd)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user