From ec6c87d12062576271231b88364a4aa00765ae65 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 15 Aug 2026 03:28:02 +0800 Subject: feat(core): allow pre_dispatch hooks to mutate arguments Change `HookPreDispatchInfo.arguments` from `&[String]` to `&mut Vec` so hooks can rewrite command-line arguments before dispatch. --- mingling_core/src/program/repl_exec.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mingling_core/src/program/repl_exec.rs') diff --git a/mingling_core/src/program/repl_exec.rs b/mingling_core/src/program/repl_exec.rs index 9d9be30..b91f7bc 100644 --- a/mingling_core/src/program/repl_exec.rs +++ b/mingling_core/src/program/repl_exec.rs @@ -58,10 +58,10 @@ where line: &mut readline, }); - let args = split_input_string(&readline); + let mut args = split_input_string(&readline); p.run_hook_repl_pre_exec(&crate::hook::HookREPLPreExecInfo { args: &args }); - match might_be_async::invoke!(exec_once(p, &args)) { + match might_be_async::invoke!(exec_once(p, &mut args)) { Ok(r) => { p.run_hook_repl_on_receive_result(&crate::hook::HookREPLOnReceiveResultInfo { result: &r, @@ -91,13 +91,13 @@ where #[cfg(not(feature = "async"))] fn exec_once( p: &'static Program, - args: &[String], + args: &mut Vec, ) -> Result where C: ProgramCollect + Send + Sync + 'static, { #[cfg(panic = "abort")] - let exec_result = super::exec::exec_with_args(p, &args); + let exec_result = super::exec::exec_with_args(p, args); #[cfg(not(panic = "abort"))] let exec_result = { @@ -130,7 +130,7 @@ where #[cfg(feature = "async")] async fn exec_once( p: &'static Program, - args: &[String], + args: &mut Vec, ) -> Result where C: ProgramCollect + Send + Sync + 'static, -- cgit