fix: adapt for Yazi v25.5.28
Closes https://github.com/yazi-rs/plugins/pull/116 Closes https://github.com/yazi-rs/plugins/pull/118 Closes https://github.com/yazi-rs/plugins/pull/121
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
--- @since 25.4.8
|
||||
--- @since 25.5.28
|
||||
|
||||
local root = ya.sync(function() return cx.active.current.cwd end)
|
||||
|
||||
@@ -6,7 +6,7 @@ local function fail(content) return ya.notify { title = "VCS Files", content = c
|
||||
|
||||
local function entry()
|
||||
local root = root()
|
||||
local output, err = Command("git"):cwd(tostring(root)):args({ "diff", "--name-only", "HEAD" }):output()
|
||||
local output, err = Command("git"):cwd(tostring(root)):arg({ "diff", "--name-only", "HEAD" }):output()
|
||||
if err then
|
||||
return fail("Failed to run `git diff`, error: " .. err)
|
||||
elseif not output.status.success then
|
||||
@@ -15,8 +15,8 @@ local function entry()
|
||||
|
||||
local id = ya.id("ft")
|
||||
local cwd = root:into_search("Git changes")
|
||||
ya.mgr_emit("cd", { Url(cwd) })
|
||||
ya.mgr_emit("update_files", { op = fs.op("part", { id = id, url = Url(cwd), files = {} }) })
|
||||
ya.emit("cd", { Url(cwd) })
|
||||
ya.emit("update_files", { op = fs.op("part", { id = id, url = Url(cwd), files = {} }) })
|
||||
|
||||
local files = {}
|
||||
for line in output.stdout:gmatch("[^\r\n]+") do
|
||||
@@ -26,8 +26,8 @@ local function entry()
|
||||
files[#files + 1] = File { url = url, cha = cha }
|
||||
end
|
||||
end
|
||||
ya.mgr_emit("update_files", { op = fs.op("part", { id = id, url = Url(cwd), files = files }) })
|
||||
ya.mgr_emit("update_files", { op = fs.op("done", { id = id, url = cwd, cha = Cha { kind = 16 } }) })
|
||||
ya.emit("update_files", { op = fs.op("part", { id = id, url = Url(cwd), files = files }) })
|
||||
ya.emit("update_files", { op = fs.op("done", { id = id, url = cwd, cha = Cha { kind = 16 } }) })
|
||||
end
|
||||
|
||||
return { entry = entry }
|
||||
|
||||
Reference in New Issue
Block a user