mecha10-cli 0.1.47

Mecha10 CLI tool
Documentation
//! Infrastructure types

#![allow(dead_code)]

/// Arguments for infrastructure command
#[derive(Debug, Clone)]
pub struct InfrastructureArgs {
    pub action: InfrastructureAction,
    pub services: Vec<String>,
}

/// Infrastructure action
#[derive(Debug, Clone, PartialEq)]
pub enum InfrastructureAction {
    Start,
    Stop,
    Restart,
    Status,
    #[allow(dead_code)] // Handler exists, CLI command not yet implemented
    Logs,
}

impl InfrastructureAction {
    #[allow(dead_code)] // Planned for future use
    pub fn parse(s: &str) -> Option<Self> {
        match s {
            "start" => Some(Self::Start),
            "stop" => Some(Self::Stop),
            "restart" => Some(Self::Restart),
            "status" => Some(Self::Status),
            "logs" => Some(Self::Logs),
            _ => None,
        }
    }

    #[allow(dead_code)] // Planned for future use
    pub fn as_str(&self) -> &str {
        match self {
            Self::Start => "start",
            Self::Stop => "stop",
            Self::Restart => "restart",
            Self::Status => "status",
            Self::Logs => "logs",
        }
    }
}