mecha10_cli/infrastructure/
types.rs1#![allow(dead_code)]
4
5use mecha10_core::enum_str_method;
6
7#[derive(Debug, Clone)]
9pub struct InfrastructureArgs {
10 pub action: InfrastructureAction,
11 pub services: Vec<String>,
12}
13
14#[derive(Debug, Clone, PartialEq)]
16pub enum InfrastructureAction {
17 Start,
18 Stop,
19 Restart,
20 Status,
21 #[allow(dead_code)] Logs,
23}
24
25impl InfrastructureAction {
26 #[allow(dead_code)] 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)] pub fn as_str(InfrastructureAction) -> &str {
42 Start => "start",
43 Stop => "stop",
44 Restart => "restart",
45 Status => "status",
46 Logs => "logs",
47 }
48);