refactor(#2886): multi instance: node class refactoring: extract links, *_git_status (#2944)

* extract DirectoryLinkNode and FileLinkNode, move Node methods to children

* temporarily move DirectoryNode methods into BaseNode for easier reviewing

* move mostly unchanged DirectoryNode methods back to BaseNode

* tidy

* git.git_status_file takes an array

* update git status of links

* luacheck hack
This commit is contained in:
Alexander Courtis
2024-10-11 17:49:34 +11:00
parent 8859bbb3b8
commit 98ca98cd87
9 changed files with 256 additions and 184 deletions

View File

@@ -21,6 +21,25 @@ function M.raw(typ, fmt, ...)
end
end
--- Write to a new file
---@param typ string as per log.types config
---@param path string absolute path
---@param fmt string for string.format
---@param ... any arguments for string.format
function M.file(typ, path, fmt, ...)
if not M.enabled(typ) then
return
end
local line = string.format(fmt, ...)
local file = io.open(path, "w")
if file then
io.output(file)
io.write(line)
io.close(file)
end
end
---@class Profile
---@field start number nanos
---@field tag string