mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
5dc4695e98
commit
e13a03ce4e
1 changed files with 6 additions and 11 deletions
|
|
@ -8,11 +8,9 @@ local state = ya.sync(function()
|
|||
return cx.active.current.cwd, selected
|
||||
end)
|
||||
|
||||
function M:setup(tbl)
|
||||
tbl = tbl or {}
|
||||
if tbl.opts then
|
||||
self.opts = table.concat(tbl.opts, " ")
|
||||
end
|
||||
function M:setup(opts)
|
||||
opts = opts or {}
|
||||
self.args = opts.args
|
||||
end
|
||||
|
||||
function M:entry()
|
||||
|
|
@ -37,17 +35,14 @@ function M:entry()
|
|||
end
|
||||
|
||||
function M:run_with(cwd, selected)
|
||||
local cmd = Command("fzf")
|
||||
local child, err = Command("fzf")
|
||||
:arg("-m")
|
||||
:args(self.args or {})
|
||||
:cwd(tostring(cwd))
|
||||
:stdin(#selected > 0 and Command.PIPED or Command.INHERIT)
|
||||
:stdout(Command.PIPED)
|
||||
:spawn()
|
||||
|
||||
if self.opts then
|
||||
cmd:env("FZF_DEFAULT_OPTS", self.opts)
|
||||
end
|
||||
|
||||
local child, err = cmd:spawn()
|
||||
if not child then
|
||||
return nil, Err("Failed to start `fzf`, error: %s", err)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue