refactor(command): display command results from special function

This commit is contained in:
Khaïs COLIN 2025-05-03 19:21:05 +02:00
parent 4435b375ef
commit 1f90d0acc3
4 changed files with 35 additions and 7 deletions

View file

@ -8,19 +8,30 @@ pub enum Command {
pub struct CommandExecuteResult {
pub should_exit: bool,
msg: String,
}
impl CommandExecuteResult {
pub fn display(&self) -> String {
self.msg.to_string()
}
}
impl From<MetaCommandExecuteResult> for CommandExecuteResult {
fn from(value: MetaCommandExecuteResult) -> Self {
Self {
should_exit: value.should_exit,
msg: String::new(),
}
}
}
impl From<StatementExecuteResult> for CommandExecuteResult {
fn from(_value: StatementExecuteResult) -> Self {
Self { should_exit: false }
fn from(value: StatementExecuteResult) -> Self {
Self {
should_exit: false,
msg: value.msg,
}
}
}