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/exec.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 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 f578064..072f4cb 100644 --- a/mingling_core/src/program/exec.rs +++ b/mingling_core/src/program/exec.rs @@ -73,14 +73,14 @@ where /// Match user input against registered dispatchers and return the matched dispatcher and remaining arguments. #[allow(clippy::type_complexity)] -fn match_user_input( +pub fn match_user_input( program: &Program, ) -> Result<(&Box + Send + Sync>, Vec), ProgramInternalExecuteError> where C: ProgramCollect, G: Display, { - let nodes = get_nodes(program); + let nodes = program.get_nodes(); let command = format!("{} ", program.args.join(" ")); // Find all nodes that match the command prefix @@ -140,22 +140,3 @@ fn render, G: Display>( } } } - -// Get all registered dispatcher names from the program -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