From 58ef8a8f42a68c7a81118ef9120705730ce3f458 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 11 Apr 2026 16:50:57 +0800 Subject: Add shell completion script generation feature --- mingling_core/src/program.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mingling_core/src/program.rs') diff --git a/mingling_core/src/program.rs b/mingling_core/src/program.rs index 7b9f8d4..42ca531 100644 --- a/mingling_core/src/program.rs +++ b/mingling_core/src/program.rs @@ -164,6 +164,11 @@ where } } } + + // Get all registered dispatcher names from the program + pub fn get_nodes(&self) -> Vec<(String, &Box + Send + Sync>)> { + get_nodes(self) + } } /// Collected program context @@ -251,3 +256,22 @@ macro_rules! __dispatch_program_chains { } }; } + +// Get all registered dispatcher names from the program +pub fn get_nodes, G: Display>( + program: &Program, +) -> Vec<(String, &Box + Send + Sync>)> { + program + .dispatcher + .iter() + .map(|disp| { + let node_str = disp + .node() + .to_string() + .split('.') + .collect::>() + .join(" "); + (node_str, disp) + }) + .collect() +} -- cgit