Add nonterminal with function
For making tab completion work properly
This commit is contained in:
parent
9e58e3d7de
commit
4319c802f5
@ -13,6 +13,7 @@ pub enum CommandTree {
|
||||
name: String,
|
||||
children: Vec<CommandTree>,
|
||||
help_msg: Option<String>,
|
||||
function: Option<BoxedCommandFunction>,
|
||||
},
|
||||
Top(Vec<CommandTree>),
|
||||
}
|
||||
@ -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<CommandTree>, func: BoxedCommandFunction) -> CommandTree {
|
||||
CommandTree::NonTerminal {
|
||||
name: s.to_string(),
|
||||
help_msg: help.map(|x| x.to_string()),
|
||||
children,
|
||||
function: Some(func),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user