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/exec.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'mingling_core/src/program/exec.rs') diff --git a/mingling_core/src/program/exec.rs b/mingling_core/src/program/exec.rs index 923b47b..b0a5b16 100644 --- a/mingling_core/src/program/exec.rs +++ b/mingling_core/src/program/exec.rs @@ -15,13 +15,14 @@ pub fn exec(program: &'static Program) -> Result + Send + Sync, { - might_be_async::invoke!(exec_with_args(program, &program.args)) + let mut args = program.args.clone(); + might_be_async::invoke!(exec_with_args(program, &mut args)) } #[might_be_async::func] pub fn exec_with_args( program: &'static Program, - args: &[String], + args: &mut Vec, ) -> Result where C: ProgramCollect + Send + Sync, @@ -51,7 +52,9 @@ where // Run hooks control!( - program.run_hook_pre_dispatch(&crate::hook::HookPreDispatchInfo { arguments: args }), + program.run_hook_pre_dispatch(&mut crate::hook::HookPreDispatchInfo { + arguments: &mut *args, + }), current ); -- cgit