mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(picker.files): added ft
option to filter by extension(s)
This commit is contained in:
parent
d56cd48e4c
commit
12a7ea28b9
5 changed files with 25 additions and 2 deletions
|
@ -72,6 +72,23 @@ local function get_cmd(opts, filter)
|
|||
end
|
||||
end
|
||||
|
||||
-- extensions
|
||||
local ft = opts.ft or {}
|
||||
ft = type(ft) == "string" and { ft } or ft
|
||||
---@cast ft string[]
|
||||
for _, e in ipairs(ft) do
|
||||
if is_fd then
|
||||
table.insert(args, "-e")
|
||||
table.insert(args, e)
|
||||
elseif is_rg then
|
||||
table.insert(args, "-g")
|
||||
table.insert(args, "*." .. e)
|
||||
elseif is_find then
|
||||
table.insert(args, "-name")
|
||||
table.insert(args, "*." .. e)
|
||||
end
|
||||
end
|
||||
|
||||
-- hidden
|
||||
if opts.hidden and is_fd_rg then
|
||||
table.insert(args, "--hidden")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue