diff --git a/yazi-plugin/src/config/config.rs b/yazi-plugin/src/config/config.rs index 6651f2f5..6419d2c3 100644 --- a/yazi-plugin/src/config/config.rs +++ b/yazi-plugin/src/config/config.rs @@ -1,7 +1,8 @@ use mlua::{IntoLua, Lua, LuaSerdeExt, SerializeOptions, Value}; +use yazi_boot::ARGS; use yazi_config::{MANAGER, PREVIEW, THEME}; -use crate::Composer; +use crate::{Composer, url::Url}; pub const OPTS: SerializeOptions = SerializeOptions::new().serialize_none_to_null(false).serialize_unit_to_null(false); @@ -14,6 +15,7 @@ impl<'a> Config<'a> { pub fn compose(lua: &Lua) -> mlua::Result { Composer::make(lua, 5, |lua, key| { match key { + b"args" => Self::args(lua)?, b"manager" => Self::manager(lua)?, b"plugin" => super::Plugin::compose(lua)?, b"preview" => Self::preview(lua)?, @@ -23,6 +25,16 @@ impl<'a> Config<'a> { }) } + fn args(lua: &Lua) -> mlua::Result { + Composer::make(lua, 5, |lua, key| { + match key { + b"chooser_file" => ARGS.chooser_file.as_ref().map(Url::from).into_lua(lua)?, + _ => return Ok(Value::Nil), + } + .into_lua(lua) + }) + } + fn manager(lua: &Lua) -> mlua::Result { Composer::make(lua, 5, |lua, key| { match key {