mecha10_cli/infrastructure/
types.rs1#![allow(dead_code)]
4
5#[derive(Debug, Clone)]
7pub struct InfrastructureArgs {
8 pub action: InfrastructureAction,
9 pub services: Vec<String>,
10}
11
12#[derive(Debug, Clone, PartialEq)]
14pub enum InfrastructureAction {
15 Start,
16 Stop,
17 Restart,
18 Status,
19 #[allow(dead_code)] Logs,
21}
22
23impl InfrastructureAction {
24 #[allow(dead_code)] pub fn parse(s: &str) -> Option<Self> {
26 match s {
27 "start" => Some(Self::Start),
28 "stop" => Some(Self::Stop),
29 "restart" => Some(Self::Restart),
30 "status" => Some(Self::Status),
31 "logs" => Some(Self::Logs),
32 _ => None,
33 }
34 }
35
36 #[allow(dead_code)] pub fn as_str(&self) -> &str {
38 match self {
39 Self::Start => "start",
40 Self::Stop => "stop",
41 Self::Restart => "restart",
42 Self::Status => "status",
43 Self::Logs => "logs",
44 }
45 }
46}