diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-15 03:28:02 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-15 03:28:02 +0800 |
| commit | ec6c87d12062576271231b88364a4aa00765ae65 (patch) | |
| tree | c1fcc3583aaffa06c0857403b557231719dde1af /mingling_core/src/program/hook/hook_info.rs | |
| parent | 372eb14ab9a9b7fc0e5334ca15a9d8b656140e54 (diff) | |
feat(core): allow pre_dispatch hooks to mutate arguments
Change `HookPreDispatchInfo.arguments` from `&[String]` to `&mut
Vec<String>`
so hooks can rewrite command-line arguments before dispatch.
Diffstat (limited to 'mingling_core/src/program/hook/hook_info.rs')
| -rw-r--r-- | mingling_core/src/program/hook/hook_info.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mingling_core/src/program/hook/hook_info.rs b/mingling_core/src/program/hook/hook_info.rs index 768f652..25cf272 100644 --- a/mingling_core/src/program/hook/hook_info.rs +++ b/mingling_core/src/program/hook/hook_info.rs @@ -7,7 +7,10 @@ pub struct HookBeginInfo {} /// Represents the data passed to `pre_dispatch` hook. pub struct HookPreDispatchInfo<'a> { /// Arguments entered by the user before dispatching - pub arguments: &'a [String], + /// + /// The reference is mutable so the hook can rewrite the arguments before + /// they are matched against the registered dispatchers. + pub arguments: &'a mut Vec<String>, } /// Represents the data passed to `post_dispatch` hook. |
