This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: parse the log for a list of shreds #6
Labels
help wanted
Extra attention is needed
Comments
something like this: https://gist.github.com/gacallea/254cb01872a034222c6034826e4bdc61 |
notes from discord:
|
after a long discord session we realized the code parsing works in a lua script and:
|
maybe something like this: https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044 |
from nvim on matrix, this should be it: local b = vim.api.nvim_create_buf(true, true)
local w = vim.api.nvim_open_win(b, true, { relative = "editor", row = 10, col = 10, width = 30, height = 10 })
vim.bo[b].bufhidden = "wipe"
local l = ""
local j = vim.fn.jobstart({ "tail", "-f", "foo.log" }, {
on_stdout = function(_, data, _)
if not vim.api.nvim_buf_is_valid(b) then
return
end
data[1] = l .. data[1]
l = data[#data]
data[#data] = nil
vim.api.nvim_buf_set_lines(b, -1, -1, true, data)
vim.api.nvim_win_set_cursor(w, { vim.api.nvim_buf_line_count(b), 0 })
end,
})
vim.api.nvim_create_autocmd("BufWipeout", {
buffer = b,
once = true,
callback = function()
vim.fn.jobstop(j)
end,
}) will implement it tomorrow. |
parsing teh log now works! local function shred_set(line)
local action = set_action(line)
if line and action then
shreds.set_table(line, action) -- this works and the table is populated
layout.shreds_tree:render() -- the UI isn't updating tho. look into set_nodes?
end
end
local function shred_lines(logfile)
local line = ""
vim.fn.jobstart({ "tail", "-f", tostring(logfile) }, {
on_stdout = function(_, data, _)
data[1] = line .. data[1]
line = data[#data]
data[#data] = nil
if #data > 0 then
shred_set(data[#data])
end
end,
})
end |
fixed! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
To replicate webchuck ui and to avoid running a --status command every time, implement a shred list.
The text was updated successfully, but these errors were encountered: