Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System Redesign #152

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
404 changes: 208 additions & 196 deletions README.md

Large diffs are not rendered by default.

457 changes: 245 additions & 212 deletions doc/vgit.txt

Large diffs are not rendered by default.

1,906 changes: 270 additions & 1,636 deletions lua/vgit.lua

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions lua/vgit/Command.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
local console = require('vgit.core.console')
local Object = require('vgit.core.Object')

local Command = Object:extend()

function Command:new()
return setmetatable({}, Command)
end

function Command:execute(command, ...)
local vgit = require('vgit')
if not command then
return
end
local starts_with = command:sub(1, 1)
if
starts_with == '_'
or not vgit[command]
or not type(vgit[command]) == 'function'
then
console.error(string.format('Invalid VGit command %s', command))
return
end
return vgit[command](...)
end

function Command:list(arglead, line)
local vgit = require('vgit')
local parsed_line = #vim.split(line, '%s+')
local matches = {}
if parsed_line == 2 then
for name, func in pairs(vgit) do
if
not vim.startswith(name, '_')
and vim.startswith(name, arglead)
and type(func) == 'function'
then
matches[#matches + 1] = name
end
end
end
return matches
end

return Command
Loading