This commit is contained in:
sxyazi 2024-02-04 08:13:20 +08:00
parent e40e443cc1
commit c5f53bf74c
No known key found for this signature in database
3 changed files with 17 additions and 19 deletions

View file

@ -12,7 +12,7 @@ pub fn slim_lua() -> mlua::Result<Lua> {
crate::fs::install(&lua)?;
crate::process::install(&lua)?;
crate::utils::Utils::install(&lua)?;
crate::utils::install(&lua)?;
crate::Config::new(&lua).install_preview()?;
// Elements

View file

@ -10,7 +10,7 @@ pub fn init() {
crate::Loader::init();
crate::Config::new(lua).install_boot()?.install_manager()?.install_theme()?;
crate::utils::init();
crate::utils::pour(lua)?;
crate::utils::install(lua)?;
// Base
lua.load(include_str!("../preset/inspect/inspect.lua")).exec()?;

View file

@ -3,26 +3,24 @@ pub(super) static USERS_CACHE: yazi_shared::RoCell<uzers::UsersCache> = yazi_sha
pub(super) static HOSTNAME_CACHE: std::sync::OnceLock<Option<String>> = std::sync::OnceLock::new();
pub struct Utils;
pub(super) struct Utils;
impl Utils {
pub fn install(lua: &mlua::Lua) -> mlua::Result<()> {
let ya: mlua::Table = lua.create_table()?;
pub fn install(lua: &mlua::Lua) -> mlua::Result<()> {
let ya: mlua::Table = lua.create_table()?;
Utils::cache(lua, &ya)?;
Utils::call(lua, &ya)?;
Utils::image(lua, &ya)?;
Utils::layer(lua, &ya)?;
Utils::log(lua, &ya)?;
Utils::plugin(lua, &ya)?;
Utils::preview(lua, &ya)?;
Utils::target(lua, &ya)?;
Utils::text(lua, &ya)?;
Utils::time(lua, &ya)?;
Utils::user(lua, &ya)?;
Utils::cache(lua, &ya)?;
Utils::call(lua, &ya)?;
Utils::image(lua, &ya)?;
Utils::layer(lua, &ya)?;
Utils::log(lua, &ya)?;
Utils::plugin(lua, &ya)?;
Utils::preview(lua, &ya)?;
Utils::target(lua, &ya)?;
Utils::text(lua, &ya)?;
Utils::time(lua, &ya)?;
Utils::user(lua, &ya)?;
lua.globals().set("ya", ya)
}
lua.globals().set("ya", ya)
}
pub fn init() {