Skip to main content

mecha10_cli/infrastructure/
types.rs

1//! Infrastructure types
2
3#![allow(dead_code)]
4
5use mecha10_core::enum_str_method;
6
7/// Arguments for infrastructure command
8#[derive(Debug, Clone)]
9pub struct InfrastructureArgs {
10    pub action: InfrastructureAction,
11    pub services: Vec<String>,
12}
13
14/// Infrastructure action
15#[derive(Debug, Clone, PartialEq)]
16pub enum InfrastructureAction {
17    Start,
18    Stop,
19    Restart,
20    Status,
21    #[allow(dead_code)] // Handler exists, CLI command not yet implemented
22    Logs,
23}
24
25impl InfrastructureAction {
26    #[allow(dead_code)] // Planned for future use
27    pub fn parse(s: &str) -> Option<Self> {
28        match s {
29            "start" => Some(Self::Start),
30            "stop" => Some(Self::Stop),
31            "restart" => Some(Self::Restart),
32            "status" => Some(Self::Status),
33            "logs" => Some(Self::Logs),
34            _ => None,
35        }
36    }
37}
38
39enum_str_method!(
40    #[allow(dead_code)] // Planned for future use
41    pub fn as_str(InfrastructureAction) -> &str {
42        Start => "start",
43        Stop => "stop",
44        Restart => "restart",
45        Status => "status",
46        Logs => "logs",
47    }
48);