Skip to content

Commit

Permalink
refactor!: system redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
tanvirtin committed Dec 25, 2021
1 parent 5eee0e7 commit 8c4237b
Show file tree
Hide file tree
Showing 163 changed files with 10,249 additions and 8,231 deletions.
396 changes: 205 additions & 191 deletions README.md

Large diffs are not rendered by default.

454 changes: 243 additions & 211 deletions doc/vgit.txt

Large diffs are not rendered by default.

1,888 changes: 256 additions & 1,632 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

0 comments on commit 8c4237b

Please sign in to comment.