args-cli 0.1.1

Command-line interface for args
Documentation
mod format;
mod init;
mod lint;
mod run;

use format::format;
use init::init;
use lint::lint;
use run::run;

use clap::{Parser, Subcommand};

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
#[command(arg_required_else_help = true)]
pub struct CiArgs {
    #[command(subcommand)]
    pub command: CiCommand,
}

#[derive(Subcommand, Debug)]
pub enum CiCommand {
    /// Create a new .args-ci.toml file
    Init {},

    /// Lint .args-ci.toml
    Lint {},

    /// Format .args-ci.toml
    Format {},

    /// Run a workflow in .args-ci.toml
    Run {},
}

impl CiCommand {
    pub async fn execute(&self) -> anyhow::Result<()> {
        match self {
            CiCommand::Init {} => init().await,
            CiCommand::Lint {} => lint().await,
            CiCommand::Format {} => format().await,
            CiCommand::Run {} => run().await,
        }
    }
}