use std::rc::Rc;
use menu_definition::MenuDefinition;
pub trait Command {
fn execute(&self);
}
pub struct CommandTableEntry {
pub name: String,
pub command: Rc<Command>,
}
pub struct CommandTable {
pub name: String,
pub inherit: Vec<Rc<CommandTable>>,
pub commands: Vec<CommandTableEntry>,
pub menu_definition: Option<MenuDefinition>,
}
impl CommandTable {
pub fn new(name: String,
inherit: Vec<Rc<CommandTable>>,
commands: Vec<CommandTableEntry>)
-> Rc<CommandTable> {
Rc::new(CommandTable {
name: name,
inherit: inherit,
commands: commands,
menu_definition: None,
})
}
}