diff --git a/Cargo.lock b/Cargo.lock
index 5e7d3cc5..e01e319c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2730,6 +2730,7 @@ dependencies = [
"ratatui",
"serde",
"serde_json",
+ "shell-words",
"syntect",
"tokio",
"tokio-util",
diff --git a/yazi-fm/src/app/commands/plugin.rs b/yazi-fm/src/app/commands/plugin.rs
index 6331ae5f..5219f108 100644
--- a/yazi-fm/src/app/commands/plugin.rs
+++ b/yazi-fm/src/app/commands/plugin.rs
@@ -37,14 +37,13 @@ impl App {
Lives::scope(&self.cx, |_| {
let mut plugin: Option
= None;
if let Some(b) = LOADED.read().get(&opt.name) {
- match LUA.load(b).call(()) {
+ match LUA.load(b).call(args) {
Ok(t) => plugin = Some(t),
Err(e) => ret = Err(e),
}
}
if let Some(plugin) = plugin {
- ret =
- if let Some(cb) = opt.data.cb { cb(plugin) } else { plugin.call_method("entry", args) };
+ ret = if let Some(cb) = opt.data.cb { cb(plugin) } else { plugin.call_method("entry", ()) };
}
});
diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml
index 0235eb41..35bce019 100644
--- a/yazi-plugin/Cargo.toml
+++ b/yazi-plugin/Cargo.toml
@@ -24,6 +24,7 @@ parking_lot = "^0"
ratatui = "^0"
serde = "^1"
serde_json = "^1"
+shell-words = "^1"
syntect = { version = "^5", default-features = false, features = [ "parsing", "plist-load", "regex-onig" ] }
tokio = { version = "^1", features = [ "parking_lot", "rt-multi-thread" ] }
tokio-util = "^0"
diff --git a/yazi-plugin/src/opt.rs b/yazi-plugin/src/opt.rs
index 1daa6f1c..503e5074 100644
--- a/yazi-plugin/src/opt.rs
+++ b/yazi-plugin/src/opt.rs
@@ -26,6 +26,15 @@ impl TryFrom for Opt {
bail!("invalid plugin name");
};
- Ok(Self { name, sync: e.named.contains_key("sync"), data: e.take_data().unwrap_or_default() })
+ let mut data: OptData = e.take_data().unwrap_or_default();
+
+ if let Some(args) = e.named.get("args") {
+ data.args = shell_words::split(args)?
+ .into_iter()
+ .map(|s| ValueSendable::String(s.into_bytes()))
+ .collect();
+ }
+
+ Ok(Self { name, sync: e.named.contains_key("sync"), data })
}
}