mecha10-cli 0.7.0

Mecha10 CLI tool
Documentation
//! Logs command arguments

use clap::{Args, Subcommand};

#[derive(Subcommand, Debug)]
pub enum LogsCommand {
    Dev(#[command(flatten)] LogsArgs),

    Remote(#[command(flatten)] LogsRemoteArgs),
}

#[derive(Args, Debug)]
pub struct LogsArgs {
    #[arg(value_name = "NODE")]
    pub node: Option<String>,

    #[arg(short, long, default_value = "true", action = clap::ArgAction::SetTrue)]
    pub follow: bool,

    #[arg(long, conflicts_with = "follow")]
    pub no_follow: bool,

    #[arg(short = 'g', long, value_name = "PATTERN")]
    pub filter: Option<String>,

    #[arg(short = 'n', long, value_name = "LINES", default_value = "100")]
    pub lines: Option<usize>,

    #[arg(short = 's', long, value_name = "SOURCE", value_enum)]
    pub source: Option<LogSource>,

    #[arg(short = 't', long)]
    pub timestamps: bool,

    #[arg(long, value_name = "LEVEL")]
    pub level: Option<String>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
pub enum LogSource {
    All,
    Nodes,
    Framework,
    Services,
}

#[derive(Args, Debug)]
pub struct LogsRemoteArgs {
    pub node: Option<String>,

    #[arg(short, long)]
    pub follow: bool,

    #[arg(short = 'n', long, default_value = "100")]
    pub tail: u32,
}