mecha10-cli 4.2.14

Mecha10 CLI tool
Documentation
//! Build command arguments

use clap::{Args, Subcommand, ValueEnum};

#[derive(Subcommand, Debug)]
pub enum BuildCommand {
    Robot(BuildTargetArgs),

    Remote(BuildTargetArgs),

    Rl(BuildTargetArgs),
}

#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum VersionBump {
    Patch,
    Minor,
    Major,
}

/// Where a `mecha10 build` invocation actually runs the compile (LAB-5442, part of the
/// "build via mecha10 dashboard" feature, LAB-2153): on this machine (the long-standing
/// behavior), or uploaded to the mecha10 dashboard/platform for a remote/cloud build.
/// Deliberately a separate axis from `BuildTargetArgs::target`/`BuildCommand`'s
/// `robot`/`remote`/`rl` choice (which node class to build *for*), not a new variant of it -
/// a dashboard build can be requested for any of those.
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum BuildLocation {
    Local,
    Dashboard,
}

#[derive(Args, Debug, Clone)]
pub struct BuildTargetArgs {
    #[arg(short, long)]
    pub target: Option<String>,

    #[arg(long, value_enum, conflicts_with = "version")]
    pub bump: Option<VersionBump>,

    #[arg(long, conflicts_with = "bump")]
    pub version: Option<String>,

    #[arg(long)]
    pub dev: bool,

    #[arg(long)]
    pub non_interactive: bool,

    /// Build locally or upload the project to the mecha10 dashboard for a remote build.
    /// Prompted interactively when omitted and the terminal is interactive; defaults to
    /// `local` otherwise (LAB-5442).
    #[arg(long, value_enum)]
    pub location: Option<BuildLocation>,
}