diff options
Diffstat (limited to 'mingling_core/src/program')
| -rw-r--r-- | mingling_core/src/program/exec.rs | 23 |
1 files changed, 2 insertions, 21 deletions
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<C, G>( +pub fn match_user_input<C, G>( program: &Program<C, G>, ) -> Result<(&Box<dyn Dispatcher<G> + Send + Sync>, Vec<String>), ProgramInternalExecuteError> where C: ProgramCollect<Enum = G>, 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<C: ProgramCollect<Enum = G>, G: Display>( } } } - -// Get all registered dispatcher names from the program -fn get_nodes<C: ProgramCollect<Enum = G>, G: Display>( - program: &Program<C, G>, -) -> Vec<(String, &Box<dyn Dispatcher<G> + Send + Sync>)> { - program - .dispatcher - .iter() - .map(|disp| { - let node_str = disp - .node() - .to_string() - .split('.') - .collect::<Vec<_>>() - .join(" "); - (node_str, disp) - }) - .collect() -} |
