chore: bump the minimum required Yazi version to 25.2.7

This commit is contained in:
sxyazi
2025-02-07 20:23:05 +08:00
parent 02d18be038
commit 07258518f3
18 changed files with 56 additions and 31 deletions

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local selected_or_hovered = ya.sync(function() local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {} local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do for _, u in pairs(tab.selected) do

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function info(content) local function info(content)
return ya.notify { return ya.notify {
title = "Diff", title = "Diff",

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function setup(_, opts) local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build local old_build = Tab.build

View File

@@ -1,7 +1,7 @@
# git.yazi # git.yazi
> [!NOTE] > [!NOTE]
> Yazi v0.4.1 or later is required for this plugin to work. > Yazi v25.2.7 or later is required for this plugin to work.
Show the status of Git file changes as linemode in the file list. Show the status of Git file changes as linemode in the file list.

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local WIN = ya.target_family() == "windows" local WIN = ya.target_family() == "windows"
local PATS = { local PATS = {
{ "[MT]", 6 }, -- Modified { "[MT]", 6 }, -- Modified
@@ -159,9 +161,6 @@ local function fetch(_, job)
local repo = root(cwd) local repo = root(cwd)
if not repo then if not repo then
remove(tostring(cwd)) remove(tostring(cwd))
if not ya.__250127 then -- TODO: remove this
return 1
end
return true return true
end end
@@ -178,10 +177,6 @@ local function fetch(_, job)
:stdout(Command.PIPED) :stdout(Command.PIPED)
:output() :output()
if not output then if not output then
if not ya.__250127 then -- TODO: remove this
ya.err("Cannot spawn git command, error: " .. err)
return 0
end
return true, Err("Cannot spawn `git` command, error: %s", err) return true, Err("Cannot spawn `git` command, error: %s", err)
end end
@@ -208,9 +203,6 @@ local function fetch(_, job)
end end
add(tostring(cwd), repo, changed) add(tostring(cwd), repo, changed)
if not ya.__250127 then -- TODO: remove this
return 3
end
return false return false
end end

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry --- @sync entry
local function entry(st) local function entry(st)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789." local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
local changed = ya.sync(function(st, new) local changed = ya.sync(function(st, new)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local M = {} local M = {}
function M:peek(job) function M:peek(job)

View File

@@ -65,12 +65,12 @@ Add following keybindings to your `~/.config/yazi/keymap.toml` to enable it:
```toml ```toml
[[manager.prepend_keymap]] [[manager.prepend_keymap]]
on = [ "b", "a" ] on = [ "b", "a" ]
run = 'plugin mactag --args="add"' run = "plugin mactag add"
desc = "Tag selected files" desc = "Tag selected files"
[[manager.prepend_keymap]] [[manager.prepend_keymap]]
on = [ "b", "r" ] on = [ "b", "r" ]
run = 'plugin mactag --args="remove"' run = "plugin mactag remove"
desc = "Untag selected files" desc = "Untag selected files"
``` ```

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local update = ya.sync(function(st, tags) local update = ya.sync(function(st, tags)
for path, tag in pairs(tags) do for path, tag in pairs(tags) do
st.tags[path] = #tag > 0 and tag or nil st.tags[path] = #tag > 0 and tag or nil
@@ -43,10 +45,6 @@ local function fetch(_, job)
local output, err = Command("tag"):args(paths):stdout(Command.PIPED):output() local output, err = Command("tag"):args(paths):stdout(Command.PIPED):output()
if not output then if not output then
if not ya.__250127 then -- TODO: remove this
ya.err("Cannot spawn tag command, error: " .. err)
return 0
end
return true, Err("Cannot spawn `tag` command, error: %s", err) return true, Err("Cannot spawn `tag` command, error: %s", err)
end end
@@ -65,9 +63,6 @@ local function fetch(_, job)
end end
update(tags) update(tags)
if not ya.__250127 then -- TODO: remove this
return 1
end
return true return true
end end

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry --- @sync entry
local function entry(st) local function entry(st)

View File

@@ -1,8 +1,11 @@
--- @since 25.2.7
local FILES = { local FILES = {
[".envrc"] = "text/plain", [".envrc"] = "text/plain",
[".gitconfig"] = "text/plain", [".gitconfig"] = "text/plain",
[".gitignore"] = "text/plain", [".gitignore"] = "text/plain",
[".luacheckrc"] = "text/lua", [".luacheckrc"] = "text/lua",
[".npmrc"] = "text/plain",
[".styluaignore"] = "text/plain", [".styluaignore"] = "text/plain",
[".zshenv"] = "text/plain", [".zshenv"] = "text/plain",
[".zshrc"] = "text/plain", [".zshrc"] = "text/plain",
@@ -1067,9 +1070,10 @@ function M:fetch(job)
local merged_files = ya.dict_merge(FILES, opts.with_files or {}) local merged_files = ya.dict_merge(FILES, opts.with_files or {})
local merged_exts = ya.dict_merge(EXTS, opts.with_exts or {}) local merged_exts = ya.dict_merge(EXTS, opts.with_exts or {})
local updates, unknown = {}, {} local updates, unknown, state = {}, {}, {}
for _, file in ipairs(job.files) do for i, file in ipairs(job.files) do
if file.cha.is_dummy then if file.cha.is_dummy then
state[i] = false
goto continue goto continue
end end
@@ -1082,11 +1086,11 @@ function M:fetch(job)
end end
if mime then if mime then
updates[tostring(file.url)] = mime updates[tostring(file.url)], state[i] = mime, true
elseif opts.fallback_file1 then elseif opts.fallback_file1 then
unknown[#unknown + 1] = file unknown[#unknown + 1] = file
else else
updates[tostring(file.url)] = "application/octet-stream" updates[tostring(file.url)], state[i] = "application/octet-stream", true
end end
::continue:: ::continue::
end end
@@ -1096,14 +1100,27 @@ function M:fetch(job)
end end
if #unknown > 0 then if #unknown > 0 then
job.files = unknown return self.fallback_builtin(job, unknown, state)
return require("mime"):fetch(job)
end end
if not ya.__250127 then -- TODO: remove this return state
return 1
end end
return true
function M.fallback_builtin(job, unknown, state)
local indices = {}
for i, f in ipairs(job.files) do
indices[f:hash()] = i
end
local result = require("mime"):fetch(ya.dict_merge(job, { files = unknown }))
for i, f in unknown do
if type(result) == "table" then
state[indices[f:hash()]] = result[i]
else
state[indices[f:hash()]] = result
end
end
return state
end end
return M return M

View File

@@ -1,7 +1,7 @@
# mount.yazi # mount.yazi
> [!NOTE] > [!NOTE]
> The plugin is currently very experimental, and the newest Yazi nightly is required for it to work. > 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. A mount manager for Yazi, providing disk mount, unmount, and eject functionality.

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local toggle_ui = ya.sync(function(self) local toggle_ui = ya.sync(function(self)
if self.children then if self.children then
Modal:children_remove(self.children) Modal:children_remove(self.children)
@@ -10,7 +12,7 @@ end)
local subscribe = ya.sync(function(self) local subscribe = ya.sync(function(self)
ps.unsub("mount") ps.unsub("mount")
ps.sub("mount", function() ya.manager_emit("plugin", { self._id, args = "refresh" }) end) ps.sub("mount", function() ya.manager_emit("plugin", { self._id, "refresh" }) end)
end) end)
local update_partitions = ya.sync(function(self, partitions) local update_partitions = ya.sync(function(self, partitions)

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local function setup() local function setup()
local old_layout = Tab.layout local old_layout = Tab.layout

View File

@@ -1,3 +1,4 @@
--- @since 25.2.7
--- @sync entry --- @sync entry
local function setup(self, opts) self.open_multi = opts.open_multi end local function setup(self, opts) self.open_multi = opts.open_multi end

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
local hovered = ya.sync(function() local hovered = ya.sync(function()
local h = cx.active.current.hovered local h = cx.active.current.hovered
if not h then if not h then

View File

@@ -1,3 +1,5 @@
--- @since 25.2.7
--- Verify if `sudo` is already authenticated --- Verify if `sudo` is already authenticated
--- @return boolean --- @return boolean
local function sudo_already() local function sudo_already()