feat(util): util.pick_root_dir

This commit is contained in:
Folke Lemaitre 2024-07-07 07:20:30 +02:00
parent 9f7b02fb0c
commit 197c17af57
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 2 deletions

View File

@ -61,8 +61,7 @@ function M.on_config(opts)
end
if a and b then
-- return longest
return #a > #b and a or b
return M.pick_root_dir(a, b)
end
return a or b
end
@ -70,6 +69,11 @@ function M.on_config(opts)
end)
end
function M.pick_root_dir(a, b)
-- prefer the longest path
return #a > #b and a or b
end
---@param t table
---@param ret? table
function M.flatten(t, ret)