mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Some minor changes to the error messages
This commit is contained in:
parent
285cd376a3
commit
c66f7f9e1f
10 changed files with 11 additions and 11 deletions
|
|
@ -9,7 +9,7 @@ function M:peek()
|
||||||
return ya.preview_widgets(self, {
|
return ya.preview_widgets(self, {
|
||||||
ui.Text(
|
ui.Text(
|
||||||
code == 2 and "File list in this archive is encrypted"
|
code == 2 and "File list in this archive is encrypted"
|
||||||
or "Both `7z` and `7zz` commands failed to run.\nDo you have 7-zip installed?"
|
or "Starting both `7z` and `7zz` failed. Do you have 7-zip installed?"
|
||||||
):area(self.area),
|
):area(self.area),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ function M:try_with(from, pwd, to)
|
||||||
local archive = require("archive")
|
local archive = require("archive")
|
||||||
local child, code = archive.spawn_7z { "x", "-aou", "-sccUTF-8", "-p" .. pwd, "-o" .. tostring(tmp), tostring(from) }
|
local child, code = archive.spawn_7z { "x", "-aou", "-sccUTF-8", "-p" .. pwd, "-o" .. tostring(tmp), tostring(from) }
|
||||||
if not child then
|
if not child then
|
||||||
fail("Both `7z` and `7zz` commands failed with error code %s.\nDo you have 7-zip installed?", code)
|
fail("Starting both `7z` and `7zz` failed, error code %s. Do you have 7-zip installed?", code)
|
||||||
end
|
end
|
||||||
|
|
||||||
local output, err = child:wait_with_output()
|
local output, err = child:wait_with_output()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function M:peek()
|
||||||
if output then
|
if output then
|
||||||
text = ui.Text.parse("----- File Type Classification -----\n\n" .. output.stdout)
|
text = ui.Text.parse("----- File Type Classification -----\n\n" .. output.stdout)
|
||||||
else
|
else
|
||||||
text = ui.Text(string.format("`%s` command returns %s", cmd, code))
|
text = ui.Text(string.format("Starting `%s` failed with error code %s. Do you have file(1) installed?", cmd, code))
|
||||||
end
|
end
|
||||||
|
|
||||||
ya.preview_widgets(self, { text:area(self.area):wrap(ui.Text.WRAP) })
|
ya.preview_widgets(self, { text:area(self.area):wrap(ui.Text.WRAP) })
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ function M:preload()
|
||||||
}):spawn()
|
}):spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
ya.err("`magick` command returns " .. tostring(code))
|
ya.err(string.format("Starting `magick` failed with error code %s", code))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ local function entry()
|
||||||
Command("fzf"):cwd(cwd):stdin(Command.INHERIT):stdout(Command.PIPED):stderr(Command.INHERIT):spawn()
|
Command("fzf"):cwd(cwd):stdin(Command.INHERIT):stdout(Command.PIPED):stderr(Command.INHERIT):spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
return fail("Command `fzf` failed with error code %s. Do you have it installed?", err)
|
return fail("Starting `fzf` failed with error code %s. Do you have it installed?", err)
|
||||||
end
|
end
|
||||||
|
|
||||||
local output, err = child:wait_with_output()
|
local output, err = child:wait_with_output()
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ function M:preload()
|
||||||
}):spawn()
|
}):spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
ya.err("`magick` command returns " .. tostring(code))
|
ya.err(string.format("Starting `magick` failed with error code %s", code))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function M:fetch(job)
|
||||||
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
|
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
|
||||||
local child, code = Command(cmd):args({ "-bL", "--mime-type", "--" }):args(urls):stdout(Command.PIPED):spawn()
|
local child, code = Command(cmd):args({ "-bL", "--mime-type", "--" }):args(urls):stdout(Command.PIPED):spawn()
|
||||||
if not child then
|
if not child then
|
||||||
ya.err(string.format("`%s` command returns %s", cmd, code))
|
ya.err(string.format("Starting `%s` failed with error code %s", cmd, code))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ function M:preload()
|
||||||
}):spawn()
|
}):spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
ya.err("`ffmpeg` command returns " .. tostring(code))
|
ya.err("Starting `ffmpeg` failed with error code " .. tostring(code))
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ local function entry()
|
||||||
:spawn()
|
:spawn()
|
||||||
|
|
||||||
if not child then
|
if not child then
|
||||||
return fail("Command `zoxide` failed with error code %s. Do you have it installed?", err)
|
return fail("Starting `zoxide` failed with error code %s. Do you have it installed?", err)
|
||||||
end
|
end
|
||||||
|
|
||||||
local output, err = child:wait_with_output()
|
local output, err = child:wait_with_output()
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ impl Process {
|
||||||
let (id, cmd) = (task.id, task.cmd.clone());
|
let (id, cmd) = (task.id, task.cmd.clone());
|
||||||
let result = super::shell(task.into());
|
let result = super::shell(task.into());
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
AppProxy::notify_warn(&cmd.to_string_lossy(), format!("Failed to run process: {e}"));
|
AppProxy::notify_warn(&cmd.to_string_lossy(), format!("Failed to start process: {e}"));
|
||||||
return self.succ(id);
|
return self.succ(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ impl Process {
|
||||||
Ok(_) => self.succ(id)?,
|
Ok(_) => self.succ(id)?,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.prog.send(TaskProg::New(id, 0))?;
|
self.prog.send(TaskProg::New(id, 0))?;
|
||||||
self.fail(id, format!("Failed to run process: {e}"))?;
|
self.fail(id, format!("Failed to start process: {e}"))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue