| 1 | //! Session command area: saving, forking, resuming, exporting, and the |
| 2 | //! `/relay` session-handoff artifact. |
| 3 | |
| 4 | #[cfg(all(test, feature = "long-running-tests"))] |
| 5 | mod acceptance; |
| 6 | mod compact; |
| 7 | mod export; |
| 8 | mod fork; |
| 9 | mod load; |
| 10 | mod new; |
| 11 | mod purge; |
| 12 | mod relay; |
| 13 | mod remote_control; |
| 14 | mod rename; |
| 15 | #[cfg(test)] |
| 16 | pub(crate) use rename::rename_with_manager; |
| 17 | mod save; |
| 18 | mod sessions; |
| 19 | mod structcopy; |
| 20 | // This group dir intentionally has a `session.rs` child module with the same |
| 21 | // name. The module_inception allow is a permanent structure rationale, not |
| 22 | // migration scaffolding; see docs/architecture/command-dispatch.md. |
| 23 | #[allow(clippy::module_inception)] |
| 24 | mod session; |
| 25 | |
| 26 | use crate::commands::CommandResult; |
| 27 | use crate::commands::traits::{Command, CommandGroup, FunctionCommand, RegisterCommand}; |
| 28 | |
| 29 | pub struct SessionCommands; |
| 30 | |
| 31 | impl CommandGroup for SessionCommands { |
| 32 | fn commands(&self) -> &'static [Box<dyn Command>] { |
| 33 | cached_command_list!(vec![ |
| 34 | Box::new(FunctionCommand::new( |
| 35 | rename::RenameCmd::info(), |
| 36 | rename::RenameCmd::execute, |
| 37 | )), |
| 38 | Box::new(FunctionCommand::new( |
| 39 | save::SaveCmd::info(), |
| 40 | save::SaveCmd::execute, |
| 41 | )), |
| 42 | Box::new(FunctionCommand::new( |
| 43 | fork::ForkCmd::info(), |
| 44 | fork::ForkCmd::execute, |
| 45 | )), |
| 46 | Box::new(FunctionCommand::new( |
| 47 | new::NewCmd::info(), |
| 48 | new::NewCmd::execute, |
| 49 | )), |
| 50 | Box::new(FunctionCommand::new( |
| 51 | sessions::SessionsCmd::info(), |
| 52 | sessions::SessionsCmd::execute, |
| 53 | )), |
| 54 | Box::new(FunctionCommand::new( |
| 55 | load::LoadCmd::info(), |
| 56 | load::LoadCmd::execute, |
| 57 | )), |
| 58 | Box::new(FunctionCommand::new( |
| 59 | compact::CompactCmd::info(), |
| 60 | compact::CompactCmd::execute, |
| 61 | )), |
| 62 | Box::new(FunctionCommand::new( |
| 63 | purge::PurgeCmd::info(), |
| 64 | purge::PurgeCmd::execute, |
| 65 | )), |
| 66 | Box::new(FunctionCommand::new( |
| 67 | relay::RelayCmd::info(), |
| 68 | relay::RelayCmd::execute, |
| 69 | )), |
| 70 | Box::new(FunctionCommand::new( |
| 71 | remote_control::RemoteControlCmd::info(), |
| 72 | remote_control::RemoteControlCmd::execute, |
| 73 | )), |
| 74 | Box::new(FunctionCommand::new( |
| 75 | export::ExportCmd::info(), |
| 76 | export::ExportCmd::execute, |
| 77 | )), |
| 78 | Box::new(FunctionCommand::new( |
| 79 | structcopy::StructcopyCmd::info(), |
| 80 | structcopy::StructcopyCmd::execute, |
| 81 | )), |
| 82 | ]) |
| 83 | } |
| 84 | } |
| 85 |