From 207ff0df06426c6d02cf6c5fb7100620ea9460e4 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 23 Nov 2024 18:24:25 +0800 Subject: [PATCH] .. --- yazi-plugin/preset/plugins/archive.lua | 4 ++-- yazi-plugin/preset/plugins/extract.lua | 4 ++-- yazi-plugin/preset/plugins/file.lua | 4 ++-- yazi-plugin/preset/plugins/font.lua | 2 +- yazi-plugin/preset/plugins/fzf.lua | 2 +- yazi-plugin/preset/plugins/magick.lua | 2 +- yazi-plugin/preset/plugins/mime.lua | 2 +- yazi-plugin/preset/plugins/video.lua | 8 ++++---- yazi-plugin/preset/plugins/zoxide.lua | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/yazi-plugin/preset/plugins/archive.lua b/yazi-plugin/preset/plugins/archive.lua index dabebb2d..82437a6a 100644 --- a/yazi-plugin/preset/plugins/archive.lua +++ b/yazi-plugin/preset/plugins/archive.lua @@ -9,7 +9,7 @@ function M:peek() return ya.preview_widgets(self, { ui.Text( code == 2 and "File list in this archive is encrypted" - or "Starting both `7z` and `7zz` failed. Do you have 7-zip installed?" + or "Failed to start both `7z` and `7zz`. Do you have 7-zip installed?" ):area(self.area), }) end @@ -64,7 +64,7 @@ function M.spawn_7z(args) end if not child then - return ya.err("Starting both `7z` and `7zz` failed, error: " .. last_err) + return ya.err("Failed to start both `7z` and `7zz`, error: " .. last_err) end return child, last_err end diff --git a/yazi-plugin/preset/plugins/extract.lua b/yazi-plugin/preset/plugins/extract.lua index a63171ea..7dc78f40 100644 --- a/yazi-plugin/preset/plugins/extract.lua +++ b/yazi-plugin/preset/plugins/extract.lua @@ -50,7 +50,7 @@ function M:try_with(from, pwd, to) local archive = require("archive") local child, err = archive.spawn_7z { "x", "-aou", "-sccUTF-8", "-p" .. pwd, "-o" .. tostring(tmp), tostring(from) } if not child then - fail("Starting both `7z` and `7zz` failed, error: " .. err) + fail("Failed to start both `7z` and `7zz`, error: " .. err) end local output, err = child:wait_with_output() @@ -61,7 +61,7 @@ function M:try_with(from, pwd, to) self:tidy(from, to, tmp) if not output then - fail("7zip failed to output when extracting '%s', error code %s", err, from) + fail("7zip failed to output when extracting '%s', error: %s", from, err) elseif output.status.code ~= 0 then fail("7zip exited when extracting '%s', error code %s", from, output.status.code) end diff --git a/yazi-plugin/preset/plugins/file.lua b/yazi-plugin/preset/plugins/file.lua index b2b7064b..2053b3bc 100644 --- a/yazi-plugin/preset/plugins/file.lua +++ b/yazi-plugin/preset/plugins/file.lua @@ -2,13 +2,13 @@ local M = {} function M:peek() local cmd = os.getenv("YAZI_FILE_ONE") or "file" - local output, code = Command(cmd):args({ "-bL", "--", tostring(self.file.url) }):stdout(Command.PIPED):output() + local output, err = Command(cmd):args({ "-bL", "--", tostring(self.file.url) }):stdout(Command.PIPED):output() local text if output then text = ui.Text.parse("----- File Type Classification -----\n\n" .. output.stdout) else - text = ui.Text(string.format("Starting `%s` failed with error code %s. Do you have file(1) installed?", cmd, code)) + text = ui.Text(string.format("Failed to start `%s`, error: %s", cmd, err)) end ya.preview_widgets(self, { text:area(self.area):wrap(ui.Text.WRAP) }) diff --git a/yazi-plugin/preset/plugins/font.lua b/yazi-plugin/preset/plugins/font.lua index 0a1eac4d..bf09650c 100644 --- a/yazi-plugin/preset/plugins/font.lua +++ b/yazi-plugin/preset/plugins/font.lua @@ -40,7 +40,7 @@ function M:preload() }):spawn() if not child then - ya.err("Starting `magick` failed, error: " .. err) + ya.err("Failed to start `magick`, error: " .. err) return 0 end diff --git a/yazi-plugin/preset/plugins/fzf.lua b/yazi-plugin/preset/plugins/fzf.lua index b81649b2..4d99af59 100644 --- a/yazi-plugin/preset/plugins/fzf.lua +++ b/yazi-plugin/preset/plugins/fzf.lua @@ -10,7 +10,7 @@ local function entry() Command("fzf"):cwd(cwd):stdin(Command.INHERIT):stdout(Command.PIPED):stderr(Command.INHERIT):spawn() if not child then - return fail("Starting `fzf` failed, error: " .. err) + return fail("Failed to start `fzf`, error: " .. err) end local output, err = child:wait_with_output() diff --git a/yazi-plugin/preset/plugins/magick.lua b/yazi-plugin/preset/plugins/magick.lua index bd0ca4fe..f260ebc6 100644 --- a/yazi-plugin/preset/plugins/magick.lua +++ b/yazi-plugin/preset/plugins/magick.lua @@ -33,7 +33,7 @@ function M:preload() }):spawn() if not child then - ya.err("Starting `magick` failed, error: " .. err) + ya.err("Failed to start `magick`, error: " .. err) return 0 end diff --git a/yazi-plugin/preset/plugins/mime.lua b/yazi-plugin/preset/plugins/mime.lua index 22e44834..3e1f6a6d 100644 --- a/yazi-plugin/preset/plugins/mime.lua +++ b/yazi-plugin/preset/plugins/mime.lua @@ -18,7 +18,7 @@ function M:fetch(job) local cmd = os.getenv("YAZI_FILE_ONE") or "file" local child, err = Command(cmd):args({ "-bL", "--mime-type", "--" }):args(urls):stdout(Command.PIPED):spawn() if not child then - ya.err(string.format("Starting `%s` failed, error: %s", cmd, err)) + ya.err(string.format("Failed to start `%s`, error: %s", cmd, err)) return 0 end diff --git a/yazi-plugin/preset/plugins/video.lua b/yazi-plugin/preset/plugins/video.lua index 53b09a2f..22f72809 100644 --- a/yazi-plugin/preset/plugins/video.lua +++ b/yazi-plugin/preset/plugins/video.lua @@ -62,7 +62,7 @@ function M:preload() }):spawn() if not child then - ya.err("Starting `ffmpeg` failed, error: " .. err) + ya.err("Failed to start `ffmpeg`, error: " .. err) return 0 end @@ -116,14 +116,14 @@ function M.list_meta(url, entries) local output, err = Command("ffprobe"):args({ "-v", "quiet", "-show_entries", entries, "-of", "json=c=1", tostring(url) }):output() if not output then - return nil, Err("Spawn `ffprobe` process returns %s", err) + return nil, Err("Failed to start `ffprobe`, error: " .. err) end local t = ya.json_decode(output.stdout) if not t then - return nil, Err("Failed to decode `ffprobe` output: %s", output.stdout) + return nil, Err("Failed to decode `ffprobe` output: " .. output.stdout) elseif type(t) ~= "table" then - return nil, Err("Invalid `ffprobe` output: %s", output.stdout) + return nil, Err("Invalid `ffprobe` output: " .. output.stdout) end t.format = t.format or {} diff --git a/yazi-plugin/preset/plugins/zoxide.lua b/yazi-plugin/preset/plugins/zoxide.lua index 8d2ded23..68f91827 100644 --- a/yazi-plugin/preset/plugins/zoxide.lua +++ b/yazi-plugin/preset/plugins/zoxide.lua @@ -101,7 +101,7 @@ local function entry() :spawn() if not child then - return fail("Starting `zoxide` failed, error: " .. err) + return fail("Failed to start `zoxide`, error: " .. err) end local output, err = child:wait_with_output()