返回 CodeWhale
metadata.rs
根目录 / crates / command-contract / src / metadata.rs
1 //! Portable command registration metadata.
2
3 use crate::handler::CommandHandler;
4
5 /// Static metadata describing a command without importing localization.
6 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
7 pub 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)]
17 pub enum CommandDiscovery {
18 Primary,
19 Advanced,
20 Compatibility,
21 }
22
23 /// Target registration shape. Existing TUI commands adopt it group by group.
24 pub trait RegisterCommand<R> {
25 fn info() -> &'static CommandInfo;
26 fn handler() -> CommandHandler<R>;
27 }
28
28 lines RUST