simpleci 0.0.2

A simple tool to run CICD pipelines locally
mod pipeline;
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Cli {
    #[command(subcommand)]
    command: Option<Commands>,
}

#[derive(Subcommand)]
enum Commands {
    /// Pipeline execution
    Exec {
        /// Execute a pipeline
        #[arg(short, long, default_value_t = String::from(".simple-ci.yml"))]
        file: String,
    },
    /// Create the git hook on commit
    Start,
    /// Delete the git hook
    Stop,
    /// Create the git hook and a default .simple-ci.yml file
    Init,
    /// Delete artifacts from previous pipelines
    Clean,
}

fn main() {
    let cli = Cli::parse();

    match &cli.command {
        Some(Commands::Exec { file }) => pipeline::main_exec(file),
        Some(Commands::Start) => pipeline::main_start(),
        Some(Commands::Stop) => pipeline::main_stop(),
        Some(Commands::Init) => pipeline::main_init(),
        Some(Commands::Clean) => pipeline::main_clean(),
        None => {
            eprintln!("Error: no arguments given. Try simpleci --help")
        }
    }
}