use clap::{Parser, Subcommand};
use std::process;
mod run;
#[derive(Parser)]
#[command(name = "tupa")]
#[command(about = "Tupã Language CLI", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Run {
#[arg(required_unless_present = "plan")]
file: Option<String>,
#[arg(long)]
pipeline: Option<String>,
#[arg(long)]
input: Option<String>,
#[arg(long)]
plan: Option<String>,
},
Check {
file: String,
#[arg(long, default_value = "text")]
format: String,
},
Audit {
file: String,
#[arg(long)]
input: Option<String>,
#[arg(long, default_value = "text")]
format: String,
},
Parse {
file: String,
#[arg(long, default_value = "text")]
format: String,
},
Lex {
file: String,
#[arg(long, default_value = "text")]
format: String,
},
Codegen {
file: String,
#[arg(long, default_value = "text")]
format: String,
#[arg(long)]
plan_only: bool,
},
Effects {
file: String,
#[arg(long, default_value = "text")]
format: String,
},
}
#[tokio::main]
async fn main() {
let cli = Cli::parse();
if let Err(e) = run::run(cli.command).await {
eprintln!("{}", e);
process::exit(1);
}
}