mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
fix(git): skip unsupported subcommand
This commit is contained in:
parent
b33626c63b
commit
56d1f34917
@ -2,7 +2,48 @@ local M = {}
|
||||
|
||||
local log = require('git.log')
|
||||
|
||||
local cmds = {
|
||||
'add',
|
||||
'blame',
|
||||
'branch',
|
||||
'checkout',
|
||||
'cherry-pick',
|
||||
'clean',
|
||||
'commit',
|
||||
'diff',
|
||||
'fetch',
|
||||
'log',
|
||||
'merge',
|
||||
'mv',
|
||||
'pull',
|
||||
'push',
|
||||
'remote',
|
||||
'reset',
|
||||
'rm',
|
||||
'shortlog',
|
||||
'status',
|
||||
}
|
||||
local supported_commands = {}
|
||||
|
||||
local function update_cmd()
|
||||
for _, v in ipairs(cmds) do
|
||||
supported_commands[v] = true
|
||||
end
|
||||
end
|
||||
|
||||
update_cmd()
|
||||
|
||||
|
||||
function M.run(command, ...)
|
||||
|
||||
if not supported_commands[command] then
|
||||
vim.api.nvim_echo(
|
||||
{ { ':Git ' .. command .. ' is not supported', 'WarningMsg' } },
|
||||
false,
|
||||
{}
|
||||
)
|
||||
return
|
||||
end
|
||||
local argv = { ... }
|
||||
local ok, cmd = pcall(require, 'git.command.' .. command)
|
||||
if ok then
|
||||
|
Loading…
x
Reference in New Issue
Block a user