feat(explorer): added git status. Closes #817

This commit is contained in:
Folke Lemaitre 2025-01-31 19:08:30 +01:00
parent 09bf19f15b
commit 5cae48d93c
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
11 changed files with 278 additions and 32 deletions

View file

@ -411,4 +411,19 @@ function M.pick_win(opts)
end
end
---@param path string
---@param cwd? string
---@return fun(): string?
function M.parents(path, cwd)
cwd = cwd or uv.cwd()
if not (cwd and path:sub(1, #cwd) == cwd and #path > #cwd) then
return function() end
end
local to = #cwd + 1 ---@type number?
return function()
to = path:find("/", to + 1, true)
return to and path:sub(1, to - 1) or nil
end
end
return M