Skip to main content

codewhale_command_contract/
metadata.rs

1//! Portable command registration metadata.
2
3use crate::handler::CommandHandler;
4
5/// Static metadata describing a command without importing localization.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub struct CommandInfo {
8    pub name: &'static str,
9    pub aliases: &'static [&'static str],
10    pub usage: &'static str,
11    /// Stable localization key resolved by the current TUI owner.
12    pub description_key: &'static str,
13}
14
15/// Discovery tier controlling palette and help visibility.
16#[derive(Debug, Clone, Copy, PartialEq, Eq)]
17pub enum CommandDiscovery {
18    Primary,
19    Advanced,
20    Compatibility,
21}
22
23/// Target registration shape. Existing TUI commands adopt it group by group.
24pub trait RegisterCommand<R> {
25    fn info() -> &'static CommandInfo;
26    fn handler() -> CommandHandler<R>;
27}