mirror of
https://github.com/sxyazi/yazi.git
synced 2025-01-07 08:56:46 +03:00
refactor: remove unnecessary .lua
extension
This commit is contained in:
parent
7e752df78a
commit
085f7e39bf
@ -1,4 +1,4 @@
|
||||
use std::{fs::File, io::BufReader, ops::RangeBounds, path::{Path, PathBuf}};
|
||||
use std::{fs::File, io::BufReader, path::{Path, PathBuf}};
|
||||
|
||||
use anyhow::Result;
|
||||
use exif::{In, Tag};
|
||||
|
@ -77,40 +77,40 @@ suppress_preload = false
|
||||
[plugin]
|
||||
|
||||
preloaders = [
|
||||
{ name = "*", cond = "!mime", exec = "mime.lua", multi = true, prio = "high" },
|
||||
{ name = "*", cond = "!mime", exec = "mime", multi = true, prio = "high" },
|
||||
# Image
|
||||
{ mime = "image/vnd.djvu", exec = "noop.lua" },
|
||||
{ mime = "image/*", exec = "image.lua" },
|
||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
||||
{ mime = "image/*", exec = "image" },
|
||||
# Video
|
||||
{ mime = "video/*", exec = "video.lua" },
|
||||
{ mime = "video/*", exec = "video" },
|
||||
# PDF
|
||||
{ mime = "application/pdf", exec = "pdf.lua" },
|
||||
{ mime = "application/pdf", exec = "pdf" },
|
||||
]
|
||||
previewers = [
|
||||
{ name = "*/", exec = "folder.lua", sync = true },
|
||||
{ name = "*/", exec = "folder", sync = true },
|
||||
# Code
|
||||
{ mime = "text/*", exec = "code.lua" },
|
||||
{ mime = "*/xml", exec = "code.lua" },
|
||||
{ mime = "*/javascript", exec = "code.lua" },
|
||||
{ mime = "*/x-wine-extension-ini", exec = "code.lua" },
|
||||
{ mime = "text/*", exec = "code" },
|
||||
{ mime = "*/xml", exec = "code" },
|
||||
{ mime = "*/javascript", exec = "code" },
|
||||
{ mime = "*/x-wine-extension-ini", exec = "code" },
|
||||
# JSON
|
||||
{ mime = "application/json", exec = "json.lua" },
|
||||
{ mime = "application/json", exec = "json" },
|
||||
# Image
|
||||
{ mime = "image/vnd.djvu", exec = "noop.lua" },
|
||||
{ mime = "image/*", exec = "image.lua" },
|
||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
||||
{ mime = "image/*", exec = "image" },
|
||||
# Video
|
||||
{ mime = "video/*", exec = "video.lua" },
|
||||
{ mime = "video/*", exec = "video" },
|
||||
# PDF
|
||||
{ mime = "application/pdf", exec = "pdf.lua" },
|
||||
{ mime = "application/pdf", exec = "pdf" },
|
||||
# Archive
|
||||
{ mime = "application/zip", exec = "archive.lua" },
|
||||
{ mime = "application/gzip", exec = "archive.lua" },
|
||||
{ mime = "application/x-tar", exec = "archive.lua" },
|
||||
{ mime = "application/x-bzip", exec = "archive.lua" },
|
||||
{ mime = "application/x-bzip2", exec = "archive.lua" },
|
||||
{ mime = "application/x-7z-compressed", exec = "archive.lua" },
|
||||
{ mime = "application/x-rar", exec = "archive.lua" },
|
||||
{ mime = "application/xz", exec = "archive.lua" },
|
||||
{ mime = "application/zip", exec = "archive" },
|
||||
{ mime = "application/gzip", exec = "archive" },
|
||||
{ mime = "application/x-tar", exec = "archive" },
|
||||
{ mime = "application/x-bzip", exec = "archive" },
|
||||
{ mime = "application/x-bzip2", exec = "archive" },
|
||||
{ mime = "application/x-7z-compressed", exec = "archive" },
|
||||
{ mime = "application/x-rar", exec = "archive" },
|
||||
{ mime = "application/xz", exec = "archive" },
|
||||
]
|
||||
|
||||
[input]
|
||||
|
@ -47,7 +47,7 @@ impl Manager {
|
||||
|
||||
tokio::spawn(async move {
|
||||
done.extend(todo.iter().map(|f| (f.url(), None)));
|
||||
if let Err(e) = isolate::preload("mime.lua", todo, true).await {
|
||||
if let Err(e) = isolate::preload("mime", todo, true).await {
|
||||
error!("preload in watcher failed: {e}");
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ impl Watcher {
|
||||
if reload.is_empty() {
|
||||
continue;
|
||||
}
|
||||
if let Err(e) = isolate::preload("mime.lua", reload, true).await {
|
||||
if let Err(e) = isolate::preload("mime", reload, true).await {
|
||||
error!("preload in watcher failed: {e}");
|
||||
}
|
||||
}
|
||||
|
@ -25,15 +25,15 @@ impl Loader {
|
||||
let path = BOOT.plugin_dir.join(format!("{name}.yazi/init.lua"));
|
||||
let b = fs::read(path).await.map(|v| v.into()).or_else(|_| {
|
||||
Ok(Cow::from(match name {
|
||||
"noop.lua" => include_bytes!("../preset/plugins/noop.lua") as &[u8],
|
||||
"archive.lua" => include_bytes!("../preset/plugins/archive.lua"),
|
||||
"code.lua" => include_bytes!("../preset/plugins/code.lua"),
|
||||
"folder.lua" => include_bytes!("../preset/plugins/folder.lua"),
|
||||
"image.lua" => include_bytes!("../preset/plugins/image.lua"),
|
||||
"json.lua" => include_bytes!("../preset/plugins/json.lua"),
|
||||
"mime.lua" => include_bytes!("../preset/plugins/mime.lua"),
|
||||
"pdf.lua" => include_bytes!("../preset/plugins/pdf.lua"),
|
||||
"video.lua" => include_bytes!("../preset/plugins/video.lua"),
|
||||
"noop" => include_bytes!("../preset/plugins/noop.lua") as &[u8],
|
||||
"archive" => include_bytes!("../preset/plugins/archive.lua"),
|
||||
"code" => include_bytes!("../preset/plugins/code.lua"),
|
||||
"folder" => include_bytes!("../preset/plugins/folder.lua"),
|
||||
"image" => include_bytes!("../preset/plugins/image.lua"),
|
||||
"json" => include_bytes!("../preset/plugins/json.lua"),
|
||||
"mime" => include_bytes!("../preset/plugins/mime.lua"),
|
||||
"pdf" => include_bytes!("../preset/plugins/pdf.lua"),
|
||||
"video" => include_bytes!("../preset/plugins/video.lua"),
|
||||
_ => bail!("plugin not found: {name}"),
|
||||
}))
|
||||
})?;
|
||||
|
Loading…
Reference in New Issue
Block a user