mecha10-cli 0.9.0

Mecha10 CLI tool
Documentation
//! Infrastructure types

#![allow(dead_code)]

use mecha10_core::enum_str_method;

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

#[derive(Debug, Clone, PartialEq)]
pub enum InfrastructureAction {
    Start,
    Stop,
    Restart,
    Status,
    #[allow(dead_code)]
    Logs,
}

impl InfrastructureAction {
    #[allow(dead_code)]
    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,
        }
    }
}

enum_str_method!(
    #[allow(dead_code)]
    pub fn as_str(InfrastructureAction) -> &str {
        Start => "start",
        Stop => "stop",
        Restart => "restart",
        Status => "status",
        Logs => "logs",
    }
);