mod ai;
mod auth;
mod config;
mod effect;
mod model;
mod sim;
mod system;
use anyhow::Result;
use clap::{Parser, Subcommand};
use config::AiAgent;
#[derive(Debug, Parser)]
#[command(name = "rngo")]
#[command(
about = "Data simulation CLI. See https://rngo.dev/docs/cli.",
long_about = None
)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Debug, Subcommand)]
enum Commands {
Auth {
#[command(subcommand)]
command: AuthCommands,
},
Effect {
#[command(subcommand)]
command: EffectCommands,
},
Sim {
#[command(subcommand)]
command: SimCommands,
},
System {
#[command(subcommand)]
command: SystemCommands,
},
}
#[derive(Debug, Subcommand)]
enum AuthCommands {
Login {},
Logout {},
}
#[derive(Debug, Subcommand)]
enum EffectCommands {
Infer {
#[arg(short, long)]
verbose: bool,
#[arg(short, long)]
agent: Option<AiAgent>,
},
}
#[derive(Debug, Subcommand)]
enum SimCommands {
Init {},
Run {
#[arg(short, long)]
file: Option<String>,
#[arg(long)]
stdout: bool,
},
}
#[derive(Debug, Subcommand)]
enum SystemCommands {
Infer {
#[arg(short, long)]
verbose: bool,
#[arg(short, long)]
agent: Option<AiAgent>,
},
}
#[tokio::main]
async fn main() -> Result<()> {
let args = Cli::parse();
match args.command {
Commands::Auth { command } => match command {
AuthCommands::Login {} => auth::login().await,
AuthCommands::Logout {} => auth::logout().await,
},
Commands::Effect { command } => match command {
EffectCommands::Infer { verbose, agent } => effect::infer(agent, verbose).await,
},
Commands::System { command } => match command {
SystemCommands::Infer { verbose, agent } => system::infer(agent, verbose).await,
},
Commands::Sim { command } => match command {
SimCommands::Init {} => sim::init().await,
SimCommands::Run { file, stdout } => sim::run(file, stdout).await,
},
}
}