| 1 | //! Group-owned built-in command areas. |
| 2 | //! |
| 3 | //! Each group module registers command objects into the central command |
| 4 | //! registry. Command implementation functions still live with their owning |
| 5 | //! groups, while dispatch, palette metadata, and help lookup all read from the |
| 6 | //! same registry surface. |
| 7 | |
| 8 | macro_rules! cached_command_list { |
| 9 | ($commands:expr) => {{ |
| 10 | static COMMANDS: std::sync::OnceLock<Vec<Box<dyn crate::commands::traits::Command>>> = |
| 11 | std::sync::OnceLock::new(); |
| 12 | COMMANDS.get_or_init(|| $commands).as_slice() |
| 13 | }}; |
| 14 | } |
| 15 | |
| 16 | pub mod config; |
| 17 | pub mod core; |
| 18 | pub mod debug; |
| 19 | pub mod memory; |
| 20 | pub mod plugins; |
| 21 | pub mod project; |
| 22 | pub mod session; |
| 23 | pub mod skills; |
| 24 | pub mod utility; |
| 25 | |
| 26 | use std::sync::OnceLock; |
| 27 | |
| 28 | use crate::commands::traits::CommandGroup; |
| 29 | |
| 30 | pub fn all_command_groups() -> &'static [&'static dyn CommandGroup] { |
| 31 | static GROUPS: OnceLock<Vec<&'static dyn CommandGroup>> = OnceLock::new(); |
| 32 | GROUPS |
| 33 | .get_or_init(|| { |
| 34 | vec![ |
| 35 | &core::CoreCommands, |
| 36 | &session::SessionCommands, |
| 37 | &config::ConfigCommands, |
| 38 | &debug::DebugCommands, |
| 39 | &project::ProjectCommands, |
| 40 | &skills::SkillsCommands, |
| 41 | &memory::MemoryCommands, |
| 42 | &plugins::PluginsCommands, |
| 43 | &utility::UtilityCommands, |
| 44 | ] |
| 45 | }) |
| 46 | .as_slice() |
| 47 | } |
| 48 |