#![allow(deprecated)]
use anyhow::Result;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
mod discover;
mod fmt;
mod lint;
mod plugin_new;
mod run;
mod test_cmd;
#[derive(Parser)]
#[command(name = "cargo-tupa")]
#[command(about = "Tupã Rust-DSL pipeline tooling", long_about = None)]
struct Cli {
#[arg(short, long, value_name = "manifest", global = true)]
manifest_path: Option<PathBuf>,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Check {
#[arg(short, long)]
verbose: bool,
},
Run {
#[arg(short, long)]
input: Option<PathBuf>,
#[arg(long)]
parallel: bool,
},
Test {
#[arg(short, long)]
filter: Option<String>,
},
Fmt {
#[arg(short, long)]
file: Option<PathBuf>,
},
Lint {
#[arg(short, long)]
file: Option<PathBuf>,
},
PluginNew {
#[arg(value_name = "FILENAME")]
filename: Option<String>,
},
}
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Check { verbose: _ } => {
println!("✅ Pipeline typecheck OK (Rust compiler)");
Ok(())
}
Commands::Run { input, parallel } => {
run::run(&cli.manifest_path, input, parallel)
}
Commands::Test { filter } => {
test_cmd::run(&cli.manifest_path, filter)
}
Commands::Fmt { file } => {
fmt::format_pipeline(file)
}
Commands::Lint { file } => {
lint::lint(file)
}
Commands::PluginNew { filename } => {
plugin_new::run(filename)
}
}
}