#![forbid(unsafe_code)]
use std::path::PathBuf;
use anyhow::Result;
use clap::{Parser, Subcommand};
mod cargo;
#[derive(Debug, Parser)]
#[command(name = "ruststream", version, about)]
struct Cli {
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Subcommand)]
enum Command {
Run {
#[arg(short = 'p', long, default_value = ".")]
manifest_path: PathBuf,
#[arg(long)]
release: bool,
#[arg(trailing_var_arg = true)]
args: Vec<String>,
},
Asyncapi {
#[command(subcommand)]
command: AsyncApiCommand,
},
}
#[derive(Debug, Subcommand)]
enum AsyncApiCommand {
Gen {
#[arg(short = 'p', long, default_value = ".")]
manifest_path: PathBuf,
#[arg(long)]
release: bool,
#[arg(short = 'o', long)]
out: Option<PathBuf>,
#[arg(long)]
yaml: bool,
},
}
fn main() -> Result<()> {
match Cli::parse().command {
Command::Run {
manifest_path,
release,
args,
} => cargo::run(&manifest_path, release, &args),
Command::Asyncapi {
command:
AsyncApiCommand::Gen {
manifest_path,
release,
out,
yaml,
},
} => cargo::asyncapi_gen(&manifest_path, release, out.as_deref(), yaml),
}
}