feat: lineBlame output parsing done

This commit is contained in:
2025-09-09 20:01:01 +02:00
parent c5da5cde6b
commit 832a9b11b9
3 changed files with 22 additions and 9 deletions

View File

@@ -2,3 +2,4 @@
## WIP ## WIP

View File

@@ -1,12 +1,23 @@
local lineBlame = function() local lineBlame = function(input_file_path, comma_separated_mails)
// TODO: everything local handler = io.popen("git blame -e " .. input_file_path .. " | awk '{ print $2$6}'")
local mail_blame = os.execute("git blame -e .githooks/pre-commit")
local mail_blame_awk = os.execute("git blame -e .githooks/pre-commit | awk '{ print $2 $6}'"); if handler == nil then
local test_str = "24a332e7 (<dani.heras@hotmail.com> 2025-09-08 19:42:51 +0200 39) email=$(git config user.email)" return nil
local results = test_str:match(".*<(.*)>.* ([0-9]+)\)") end
local results = test_str:match(".*<(.*)>.* ([0-9]+)\)")
local result = handler:read("L")
while result do
for k, v in string.gmatch(result, "%(<(.+)>(%d+)%)") do
print(k)
print(v)
end
result = handler:read("L")
end
handler:close()
end end
-- lineBlame("./README.md")
return { return {
lineBlame = lineBlame, lineBlame = lineBlame,
} }

View File

@@ -2,11 +2,11 @@ local blame = require("./line-blame.lua")
local defaultList = "one;two" local defaultList = "one;two"
vim.g.monkeyMailList = defaultList vim.g.monkeyMailList = defaultList
vim.g.monkeyUserList = defaultList -- vim.g.monkeyUserList = defaultList
local function setup(opts) local function setup(opts)
vim.g.monkeyMailList = opts.monkeyMailList vim.g.monkeyMailList = opts.monkeyMailList
vim.g.monkeyUserList = opts.monkeyUserList -- vim.g.monkeyUserList = opts.monkeyUserList
end end
local function observe() local function observe()
@@ -16,6 +16,7 @@ end
return { return {
setup = setup, setup = setup,
observe = observe, observe = observe,
blame = blame.lineBlame
} }
-- NOTE: -- NOTE: