Skip to main content

rush_sync_server/commands/exit/
command.rs

1use crate::commands::command::Command;
2use crate::core::prelude::*;
3use crate::i18n::get_command_translation;
4
5#[derive(Debug)]
6pub struct ExitCommand;
7
8impl Command for ExitCommand {
9    fn name(&self) -> &'static str {
10        "exit"
11    }
12
13    fn description(&self) -> &'static str {
14        "Exit the application"
15    }
16
17    fn matches(&self, command: &str) -> bool {
18        crate::matches_exact!(command, "exit" | "q")
19    }
20
21    fn execute_sync(&self, _args: &[&str]) -> Result<String> {
22        use crate::core::constants::{SIG_CONFIRM_PREFIX, SIG_EXIT};
23        let msg = get_command_translation("system.input.confirm_exit", &[]);
24        Ok(format!("{}{}{}", SIG_CONFIRM_PREFIX, SIG_EXIT, msg))
25    }
26
27    fn priority(&self) -> u8 {
28        100
29    }
30}