Skip to main content

AirLibrary/CLI/
CommandTypes.rs

1//! CLI command enum hierarchy for the Air daemon CLI.
2//!
3//! `Command` is the top-level dispatch value produced by `CliParser::parse`.
4//! Sub-enums (`ConfigCommand`, `DebugCommand`) scope arguments to logical
5//! domains. Auxiliary enums (`DiagnosticLevel`, `ValidationResult`,
6//! `PermissionLevel`) are referenced by parser and handler logic.
7
8/// Top-level CLI command.
9#[derive(Debug, Clone)]
10pub enum Command {
11	Status { service:Option<String>, verbose:bool, json:bool },
12
13	Restart { service:Option<String>, force:bool },
14
15	Config(ConfigCommand),
16
17	Metrics { json:bool, service:Option<String> },
18
19	Logs { service:Option<String>, tail:Option<usize>, filter:Option<String>, follow:bool },
20
21	Debug(DebugCommand),
22
23	Help { command:Option<String> },
24
25	Version,
26}
27
28/// Configuration management sub-commands.
29#[derive(Debug, Clone)]
30pub enum ConfigCommand {
31	Get { key:String },
32
33	Set { key:String, value:String },
34
35	Reload { validate:bool },
36
37	Show { json:bool },
38
39	Validate { path:Option<String> },
40}
41
42/// Debug and diagnostic sub-commands.
43#[derive(Debug, Clone)]
44pub enum DebugCommand {
45	DumpState { service:Option<String>, json:bool },
46
47	DumpConnections { format:Option<String> },
48
49	HealthCheck { verbose:bool, service:Option<String> },
50
51	Diagnostics { level:DiagnosticLevel },
52}
53
54/// Verbosity level for diagnostic operations.
55#[derive(Debug, Clone, Copy, PartialEq, Eq)]
56pub enum DiagnosticLevel {
57	Basic,
58
59	Extended,
60
61	Full,
62}
63
64/// Result of argument validation for a parsed command.
65#[derive(Debug, Clone)]
66pub enum ValidationResult {
67	Valid,
68
69	Invalid(String),
70}
71
72/// Minimum privilege required to execute a command.
73#[derive(Debug, Clone, Copy, PartialEq, Eq)]
74pub enum PermissionLevel {
75	User,
76
77	Admin,
78}