mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
refactor: look at the zoxide output instead of spawning fzf
This commit is contained in:
parent
b03a2f4b51
commit
505ad6b4a3
1 changed files with 2 additions and 6 deletions
|
|
@ -89,12 +89,6 @@ local function entry()
|
|||
|
||||
local _permit = ya.hide()
|
||||
|
||||
local fzf, _err = Command("fzf"):arg("--version"):stdout(Command.PIPED):stderr(Command.PIPED):output()
|
||||
|
||||
if not fzf then
|
||||
return fail(string.format("%s\n%s", "`fzf` is required for the `zoxide` plugin.", "Please install `fzf`."))
|
||||
end
|
||||
|
||||
local child, err = Command("zoxide")
|
||||
:args({ "query", "-i", "--exclude" })
|
||||
:arg(st.cwd)
|
||||
|
|
@ -114,6 +108,8 @@ local function entry()
|
|||
local output, error = child:wait_with_output()
|
||||
if not output then
|
||||
return fail("Cannot read `zoxide` output, error: " .. error)
|
||||
elseif output.stderr:find("could not find") then
|
||||
return fail(output.stderr)
|
||||
elseif not output.status.success and output.status.code ~= 130 then
|
||||
return fail("`zoxide` exited with error code %s", output.status.code)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue