use crate::branding; #[derive(Debug, Eq, PartialEq)] pub enum MetaCommand { Exit, About, } impl std::fmt::Display for MetaCommand { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { MetaCommand::Exit => write!(f, "exit"), MetaCommand::About => write!(f, "about"), } } } pub struct MetaCommandExecuteResult { pub should_exit: bool, } impl MetaCommand { pub fn execute(&self) -> MetaCommandExecuteResult { match self { MetaCommand::Exit => MetaCommandExecuteResult { should_exit: true }, MetaCommand::About => { print!("{}", branding::about_msg()); MetaCommandExecuteResult { should_exit: false } } } } }