refactor(command): display command results from special function
This commit is contained in:
parent
4435b375ef
commit
1f90d0acc3
4 changed files with 35 additions and 7 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue