diff --git a/schala-repl/src/repl/command_tree.rs b/schala-repl/src/repl/command_tree.rs index 279a338..9832f87 100644 --- a/schala-repl/src/repl/command_tree.rs +++ b/schala-repl/src/repl/command_tree.rs @@ -13,6 +13,7 @@ pub enum CommandTree { name: String, children: Vec, help_msg: Option, + function: Option, }, Top(Vec), } @@ -31,6 +32,16 @@ impl CommandTree { name: s.to_string(), help_msg: help.map(|x| x.to_string()), children, + function: None, + } + } + + pub fn nonterm_with_function(s: &str, help: Option<&str>, children: Vec, func: BoxedCommandFunction) -> CommandTree { + CommandTree::NonTerminal { + name: s.to_string(), + help_msg: help.map(|x| x.to_string()), + children, + function: Some(func), } }