| 1 | //! `/exit` command. |
| 2 | |
| 3 | use codewhale_command_contract::handler::CommandHandler; |
| 4 | use codewhale_command_contract::metadata::{CommandInfo, RegisterCommand}; |
| 5 | use codewhale_command_contract::outcome::{CommandResult, CoreAction}; |
| 6 | |
| 7 | const COMMAND_INFO: CommandInfo = CommandInfo { |
| 8 | name: "exit", |
| 9 | aliases: &["quit", "q", "tuichu"], |
| 10 | usage: "/exit", |
| 11 | description_key: "cmd_exit_description", |
| 12 | }; |
| 13 | |
| 14 | pub(super) struct ExitCmd; |
| 15 | |
| 16 | impl<A: From<CoreAction>> RegisterCommand<CommandResult<A>> for ExitCmd { |
| 17 | fn info() -> &'static CommandInfo { |
| 18 | &COMMAND_INFO |
| 19 | } |
| 20 | |
| 21 | fn handler() -> CommandHandler<CommandResult<A>> { |
| 22 | CommandHandler::Pure(|_| CommandResult::action(CoreAction::Quit.into())) |
| 23 | } |
| 24 | } |
| 25 |