diff --git a/chmod.yazi/main.lua b/chmod.yazi/main.lua index ad565c6..589ebd5 100644 --- a/chmod.yazi/main.lua +++ b/chmod.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.2.26 +--- @since 25.5.28 local selected_or_hovered = ya.sync(function() local tab, paths = cx.active, {} @@ -13,7 +13,7 @@ end) return { entry = function() - ya.mgr_emit("escape", { visual = true }) + ya.emit("escape", { visual = true }) local urls = selected_or_hovered() if #urls == 0 then @@ -28,7 +28,7 @@ return { return end - local status, err = Command("chmod"):arg(value):args(urls):spawn():wait() + local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait() if not status or not status.success then ya.notify { title = "Chmod", diff --git a/git.yazi/README.md b/git.yazi/README.md index 4c5b07c..c58e614 100644 --- a/git.yazi/README.md +++ b/git.yazi/README.md @@ -1,8 +1,5 @@ # git.yazi -> [!NOTE] -> Yazi v25.2.26 or later is required for this plugin to work. - Show the status of Git file changes as linemode in the file list. https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576 diff --git a/git.yazi/main.lua b/git.yazi/main.lua index d8f365a..fd8b8bf 100644 --- a/git.yazi/main.lua +++ b/git.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.4.4 +--- @since 25.5.28 local WINDOWS = ya.target_family() == "windows" @@ -190,8 +190,8 @@ local function fetch(_, job) -- stylua: ignore local output, err = Command("git") :cwd(tostring(cwd)) - :args({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) - :args(paths) + :arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) + :arg(paths) :stdout(Command.PIPED) :output() if not output then diff --git a/jump-to-char.yazi/main.lua b/jump-to-char.yazi/main.lua index d12538c..0398a69 100644 --- a/jump-to-char.yazi/main.lua +++ b/jump-to-char.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.2.26 +--- @since 25.5.28 local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789." @@ -24,9 +24,9 @@ return { local kw = escape(cands[idx].on) if changed(kw) then - ya.mgr_emit("find_do", { "^" .. kw }) + ya.emit("find_do", { "^" .. kw }) else - ya.mgr_emit("find_arrow", {}) + ya.emit("find_arrow", {}) end end, } diff --git a/lsar.yazi/main.lua b/lsar.yazi/main.lua index 09fb9de..1a765c4 100644 --- a/lsar.yazi/main.lua +++ b/lsar.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.2.26 +--- @since 25.5.28 local M = {} @@ -32,9 +32,9 @@ function M:peek(job) child:start_kill() if job.skip > 0 and i < job.skip + limit then - ya.mgr_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) + ya.emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) else - ya.preview_widgets(job, { ui.Text(lines):area(job.area) }) + ya.preview_widget(job, ui.Text(lines):area(job.area)) end end diff --git a/mactag.yazi/main.lua b/mactag.yazi/main.lua index 5982e1f..b823944 100644 --- a/mactag.yazi/main.lua +++ b/mactag.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.4.4 +--- @since 25.5.28 local update = ya.sync(function(st, tags) for path, tag in pairs(tags) do @@ -43,7 +43,7 @@ local function fetch(_, job) paths[#paths + 1] = tostring(file.url) end - local output, err = Command("tag"):args(paths):stdout(Command.PIPED):output() + local output, err = Command("tag"):arg(paths):stdout(Command.PIPED):output() if not output then return true, Err("Cannot spawn `tag` command, error: %s", err) end @@ -76,7 +76,7 @@ end) local function entry(self, job) assert(job.args[1] == "add" or job.args[1] == "remove", "Invalid action") - ya.mgr_emit("escape", { visual = true }) + ya.emit("escape", { visual = true }) local cands = cands() local choice = ya.which { cands = cands } @@ -91,7 +91,7 @@ local function entry(self, job) files[#files + 1] = { url = url } end - local status = Command("tag"):args(t):status() + local status = Command("tag"):arg(t):status() if status.success then fetch(self, { files = files }) end diff --git a/mime-ext.yazi/main.lua b/mime-ext.yazi/main.lua index c3e0638..0f8cdc0 100644 --- a/mime-ext.yazi/main.lua +++ b/mime-ext.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.4.4 +--- @since 25.5.28 local FILES = { [".envrc"] = "text/plain", @@ -1096,7 +1096,7 @@ function M:fetch(job) end if next(updates) then - ya.mgr_emit("update_mimes", { updates = updates }) + ya.emit("update_mimes", { updates = updates }) end if #unknown > 0 then diff --git a/mount.yazi/README.md b/mount.yazi/README.md index 6853be7..c2cfd71 100644 --- a/mount.yazi/README.md +++ b/mount.yazi/README.md @@ -1,8 +1,5 @@ # mount.yazi -> [!NOTE] -> Yazi v25.2.7 or later is required for this plugin to work. - A mount manager for Yazi, providing disk mount, unmount, and eject functionality. Supported platforms: diff --git a/mount.yazi/main.lua b/mount.yazi/main.lua index 962eeef..e933a29 100644 --- a/mount.yazi/main.lua +++ b/mount.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.2.26 +--- @since 25.5.28 local toggle_ui = ya.sync(function(self) if self.children then @@ -12,7 +12,7 @@ end) local subscribe = ya.sync(function(self) ps.unsub("mount") - ps.sub("mount", function() ya.mgr_emit("plugin", { self._id, "refresh" }) end) + ps.sub("mount", function() ya.emit("plugin", { self._id, "refresh" }) end) end) local update_partitions = ya.sync(function(self, partitions) @@ -113,7 +113,7 @@ function M:entry(job) elseif run == "enter" then local active = active_partition() if active and active.dist then - ya.mgr_emit("cd", { active.dist }) + ya.emit("cd", { active.dist }) end else tx2:send(run) @@ -233,7 +233,7 @@ function M.fillin(tbl) return tbl end - local output, err = Command("lsblk"):args({ "-p", "-o", "name,fstype", "-J" }):args(sources):output() + local output, err = Command("lsblk"):arg({ "-p", "-o", "name,fstype", "-J" }):arg(sources):output() if err then ya.dbg("Failed to fetch filesystem types for unmounted partitions: " .. err) return tbl @@ -256,14 +256,14 @@ function M.operate(type) local output, err if ya.target_os() == "macos" then - output, err = Command("diskutil"):args({ type, active.src }):output() + output, err = Command("diskutil"):arg({ type, active.src }):output() end if ya.target_os() == "linux" then if type == "eject" then - Command("udisksctl"):args({ "unmount", "-b", active.src }):status() - output, err = Command("udisksctl"):args({ "power-off", "-b", active.src }):output() + Command("udisksctl"):arg({ "unmount", "-b", active.src }):status() + output, err = Command("udisksctl"):arg({ "power-off", "-b", active.src }):output() else - output, err = Command("udisksctl"):args({ type, "-b", active.src }):output() + output, err = Command("udisksctl"):arg({ type, "-b", active.src }):output() end end diff --git a/piper.yazi/main.lua b/piper.yazi/main.lua index 409f313..0096daf 100644 --- a/piper.yazi/main.lua +++ b/piper.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.4.8 +--- @since 25.5.28 local M = {} @@ -10,13 +10,9 @@ end function M:peek(job) local child, err = Command("sh") - :args({ - "-c", - job.args[1], - }) + :arg({ "-c", job.args[1], "sh", tostring(job.file.url) }) :env("w", job.area.w) :env("h", job.area.h) - :args({ "sh", tostring(job.file.url) }) :stdout(Command.PIPED) :stderr(Command.PIPED) :spawn() @@ -45,7 +41,7 @@ function M:peek(job) if #errs > 0 then fail(job, table.concat(errs, "")) elseif job.skip > 0 and i < job.skip + limit then - ya.mgr_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) + ya.emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) else ya.preview_widgets(job, { M.format(job, outs) }) end diff --git a/smart-enter.yazi/main.lua b/smart-enter.yazi/main.lua index 8b9ae55..c69a101 100644 --- a/smart-enter.yazi/main.lua +++ b/smart-enter.yazi/main.lua @@ -1,11 +1,11 @@ ---- @since 25.2.26 +--- @since 25.5.28 --- @sync entry local function setup(self, opts) self.open_multi = opts.open_multi end local function entry(self) local h = cx.active.current.hovered - ya.mgr_emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi }) + ya.emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi }) end return { entry = entry, setup = setup } diff --git a/smart-filter.yazi/main.lua b/smart-filter.yazi/main.lua index a47acff..4141f95 100644 --- a/smart-filter.yazi/main.lua +++ b/smart-filter.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.2.26 +--- @since 25.5.28 local hovered = ya.sync(function() local h = cx.active.current.hovered @@ -28,20 +28,20 @@ local function entry() while true do local value, event = input:recv() if event ~= 1 and event ~= 3 then - ya.mgr_emit("escape", { filter = true }) + ya.emit("escape", { filter = true }) break end - ya.mgr_emit("filter_do", { value, smart = true }) + ya.emit("filter_do", { value, smart = true }) local h = hovered() if h.unique and h.is_dir then - ya.mgr_emit("escape", { filter = true }) - ya.mgr_emit("enter", {}) + ya.emit("escape", { filter = true }) + ya.emit("enter", {}) input = prompt() elseif event == 1 then - ya.mgr_emit("escape", { filter = true }) - ya.mgr_emit(h.is_dir and "enter" or "open", { h.url }) + ya.emit("escape", { filter = true }) + ya.emit(h.is_dir and "enter" or "open", { h.url }) end end end diff --git a/smart-paste.yazi/main.lua b/smart-paste.yazi/main.lua index 195644c..7740e9a 100644 --- a/smart-paste.yazi/main.lua +++ b/smart-paste.yazi/main.lua @@ -1,13 +1,14 @@ +--- @since 25.5.28 --- @sync entry return { entry = function() local h = cx.active.current.hovered if h and h.cha.is_dir then - ya.mgr_emit("enter", {}) - ya.mgr_emit("paste", {}) - ya.mgr_emit("leave", {}) + ya.emit("enter", {}) + ya.emit("paste", {}) + ya.emit("leave", {}) else - ya.mgr_emit("paste", {}) + ya.emit("paste", {}) end end, } diff --git a/sudo-demo.yazi/main.lua b/sudo-demo.yazi/main.lua index c3675cd..9c3d89b 100644 --- a/sudo-demo.yazi/main.lua +++ b/sudo-demo.yazi/main.lua @@ -1,9 +1,9 @@ ---- @since 25.2.7 +--- @since 25.5.28 --- Verify if `sudo` is already authenticated --- @return boolean local function sudo_already() - local status = Command("sudo"):args({ "--validate", "--non-interactive" }):status() + local status = Command("sudo"):arg({ "--validate", "--non-interactive" }):status() assert(status, "Failed to run `sudo --validate --non-interactive`") return status.success end @@ -16,7 +16,7 @@ end --- nil: no error --- 1: sudo failed local function run_with_sudo(program, args) - local cmd = Command("sudo"):args { program, table.unpack(args) } + local cmd = Command("sudo"):arg(program):arg(args) if sudo_already() then return cmd:output() end diff --git a/vcs-files.yazi/main.lua b/vcs-files.yazi/main.lua index 516a037..32f9649 100644 --- a/vcs-files.yazi/main.lua +++ b/vcs-files.yazi/main.lua @@ -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 }