feat(meta): add about meta-command

This commit is contained in:
Khaïs COLIN 2025-05-30 15:48:02 +02:00
parent c863d71409
commit 2dead7de0a
Signed by: logistic-bot
SSH key fingerprint: SHA256:3zI3/tx0ZpCLHCLPmEaGR4oeYCPMCzQxXhXutBmtOAU
6 changed files with 39 additions and 5 deletions

View file

@ -1,12 +1,16 @@
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"),
}
}
}
@ -19,6 +23,10 @@ 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 }
}
}
}
}